OgreNewt get... functions error

ecos

26-05-2006 09:02:05

Hi everyone,

I'm using VS C++ 8.0 Express Edition and i have this piece of code in my project:
Ogre::Vector3 com = mCar->bod->getCenterOfMass();

I build the project without errors, but when it is executed in program it throws an error.

Unhandled exception at 0x007d7f1c in test1.exe: 0xC0000005: Access violation reading location 0x00000000.


It seems like this error comes out when pointer on float is passed from NewtonBodyGetCentreOfMass that error must be generated by writing to a wrong address or something similiar...

Ogre::Vector3 Body::getCenterOfMass() const
{
Ogre::Vector3 ret;
NewtonBodyGetCentreOfMass( m_body, &ret.x );
return ret;
}

I searched the forum for some hints and nobody is complaining about same thing. Maybe they just more experienced Smile ...

Can someone help me ?

ecos

26-05-2006 15:05:53

could be something wrong with my OgreNewt dll ? I compiled it myself, because the dll that came with packed source was throwing compiling errors.

Maybe i must change compiler settings .... What do you think ?

pls help somebody .... :(

GiDEoN

26-05-2006 15:23:42

Hi everyone,

I'm using VS C++ 8.0 Express Edition and i have this piece of code in my project:
Ogre::Vector3 com = mCar->bod->getCenterOfMass();

I build the project without errors, but when it is executed in program it throws an error.

Unhandled exception at 0x007d7f1c in test1.exe: 0xC0000005: Access violation reading location 0x00000000.


It seems like this error comes out when pointer on float is passed from NewtonBodyGetCentreOfMass that error must be generated by writing to a wrong address or something similiar...

Ogre::Vector3 Body::getCenterOfMass() const
{
Ogre::Vector3 ret;
NewtonBodyGetCentreOfMass( m_body, &ret.x );
return ret;
}

I searched the forum for some hints and nobody is complaining about same thing. Maybe they just more experienced Smile ...

Can someone help me ?

the Access violation reading location 0x00000000 get me into the direction that you try to access an object that has not yet been created (or assigned). Have you assigned mCar before calling the function ?

ecos

26-05-2006 16:14:28


the Access violation reading location 0x00000000 get me into the direction that you try to access an object that has not yet been created (or assigned). Have you assigned mCar before calling the function ?

Well i think that it has been created, because the mCar class represents my simple vehicle in the scene and it is allready in the scene when i want to get or set its center of mass ..... so i assume that everything i created :D

And also I call this function on key press so it isn't called before the class is created .....
and it isn't only this in function.... :( every function in OgreNewt that returns Ogre::Vector3 throws this error....

I think when the NewtonBody is created also all these variables are created also.... so i don't think it is this problem ..... maybe it is problem of VC++ 8.0 Express Edition :D

This error is totally illogical :evil:

ecos

26-05-2006 16:38:53

Thanks GiDEoN, we were both right, it wasn't created, but also it was created :D ... so this problem is solved (i hope).
And as i said it was illogical. :wink: I found some multiple pointer declarations. i think that here was human error involved :lol: ....

And also thanks to haffax because he pointed me to this earlier :roll: