Skip to main content
gamedev.net
🔒 Locked

A passing problem

Started by Marx2052 Jun 9, 2006 at 5:28 PM 1 replies 600+ views
Original Post
Marx2052
Marx2052
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!
Skarsha
Skarsha
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);}


Marx2052
Marx2052
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.