compare two bodies

mamairaja

04-01-2010 17:50:32

Hi
This is strange error
I have a OGRE3DBody* body which i am getting from ray cast hit
OGRE3DBody* body = static_cast<OGRE3DBody*>(playerHitRay.mRigidBody);
I am getting memory leak exception when my program reach this line
if(body->getSceneNode()&& (body->getSceneNode()->getName()==playerCharacter->getCharacterNode()->getName())) //getCharacterNode return scene node

My target is to check whether ray hit body is player character body, I do not know other way other than body scene nodes node names camparison.

Error is
First-chance exception at 0x0040a1e3 in TheGameProject.exe: 0xC0000005: Access violation reading location 0xfeeeff5e.
Unhandled exception at 0x0040a1e3 in TheGameProject.exe: 0xC0000005: Access violation reading location 0xfeeeff5e.
The program '[2372] TheGameProject.exe: Native' has exited with code 0 (0x0).


I have posted it back to basic forum and they saying it it is invalid memory access and not allowed to do that.

So can some one please tell me are their any other way to compare whther two bodies are equal , any ID kind of thing?

EIDT : RaycastHit type is NxOgre::Enums::ShapesType_All

mamairaja

05-01-2010 03:25:03

Please can some one give me an ida, to compare two bodies(OGRE3DBody*) are equal

EDIT: just a question
NxOgre::Actor* actor = static_cast<NxOgre::Actor*>(playerHitRay.mRigidBody);
actor->getName ();
if this is unique and if it is ok to setName() can use this to compare two bodies?

mamairaja

05-01-2010 16:46:00

Hi again
I am getting the ray hit actor as
NxOgre::Actor* a = static_cast<NxOgre::Actor*>(playerHitRay.mRigidBody);

And I have the player body and I can talk directly to the body->getType();

By comparing ray cast hit actor type and my player body type can I compare whether these two are same?
These two seems to be unique and equal.
Can someone please confirm?