bjtp
22-04-2009 13:31:50
If I call the ~World-destructor and there are still some "Body"s assigned to that world that have an autoactiveCallback set up, the application crashes, somewhere in the boost code. I assume the callback is called but the body already deleted.
I'd like to know if that is an intended behavoir and I'm just missing some OgreNewt paradigm here. It is no big problem to clean up all bodies before calling the World-destructor, though.
(I use Newton 1.5.3, the OgreNewt.rar, Ogre 1.6.2 and Linux)
To reproduce, I added this to Demo03:
OgreNewtFrameListener.h
OgreNewtFrameListener.cpp
I'd like to know if that is an intended behavoir and I'm just missing some OgreNewt paradigm here. It is no big problem to clean up all bodies before calling the World-destructor, though.
(I use Newton 1.5.3, the OgreNewt.rar, Ogre 1.6.2 and Linux)
To reproduce, I added this to Demo03:
OgreNewtFrameListener.h
> void callback (OgreNewt::Body * me, int sleep);
OgreNewtFrameListener.cpp
Ogre::Vector3 inertia = OgreNewt::MomentOfInertia::CalcBoxSolid( mass, size );
body->setMassMatrix( mass, inertia );
body->attachToNode( node );
> body->setAutoactiveCallback <OgreNewtonFrameListener> (&OgreNewtonFrameListener::callback, this);
body->setPositionOrientation( Ogre::Vector3(-5,8,0), Ogre::Quaternion::IDENTITY );
[...]
> void OgreNewtonFrameListener::callback (OgreNewt::Body * me, int sleep) { }