Sign in to follow this  
Marx2052

A passing problem

Recommended Posts

Ok i'm attempting to implement a collision detection resource i've downloaded from: http://www.photoneffect.com/coldet The actual site has been of very little help and their forums are all but dead however that shouldn't be a problem since my question is about a specific coding problem i'm having. To detect collisions on a model u need to know the models transformation matrix so this has to be given to the collision detection every cycle my problem is here, the function that is trying to receive the matrix is as follows: virtual void setTransform(float m[16]) = 0; so i've been trying to give my D3DXMATRIX to this function i've tried putting the values into a float[16] using: float[0] = matCollision._11 etc and i've tried: setTransform((float*)&matCollision); this was suggested on their forums, however each time i recieve the same access violation error from the debugger on the call to the setTransform function: Unhandled exception at 0x00475f7c in code.exe: 0xC0000005: Access violation reading location 0xcdcdcdcd. This is in the collision codes main header: EXPORT CollisionModel3D* newCollisionModel3D(bool Static=false); and so to create the class i've put this in my header file: CollisionModel3D* model; and this in my source file: CollisionModel3D* model = newCollisionModel3D(); Any ideas as to how the problem has occured or any information which could help would be very useful. Thanks for your time, Mike!

Share this post


Link to post
Share on other sites
Something to try:

have you done:


void foo() {
// Create a test matrix:
float test[16];

// Initialise matrix to Identity matrix:
for(int x = 0; x < 4; x++) {
for(int y = 0; y < 4; y++) {
if(x == y) {
test[x * 4 + y] = 1;
} else {
test[x * 4 + y] = 0;
}
}
}

// Try, with reference to memory you know exists.
setTransform(test);
}




Share this post


Link to post
Share on other sites
Thanks for the help tho i already had that base covered.

I did manage to fix the problem tho, i decided to not use the export method of creating a reference to the class and instead made the class directly.

Seems to work fine now just gotta get the other parts working.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this