Code: Select all
void _cdecl NewtonManager::PhysicsBodyDestructor (const NewtonBody* body)
{
MeshContainer *container;
// get the graphic object form the rigid body
container = (MeshContainer*) NewtonBodyGetUserData (body);
// destroy the graphic object
//container->node->removeAll();
//container->node->drop();
//destroy the newton body
NewtonDestroyBody(NewtonBodyGetWorld( container->body ), container->body); //program terminates
// call the scene manager to delete the mesh
extern ISceneManager *smgrGlobal;
smgrGlobal->addToDeletionQueue(container->node);
};
if I use container->node->drop(); the program crashes too ("cannot access address...")
so what am I doing wrong?!
could you PLEASE help me?