NewtonBodyDestructor
NewtonBodyDestructor
typedef void (*NewtonBodyDestructor) (const NewtonBody* body);
Usage
Called whenever a newton body is destroyed using NewtonDestroyBody and has a destruct callback registered using NewtonBodySetDestructorCallback.
When this callback is set, the callback is called whenever Newton destroys a body from the World. The most common use of this callback is to help create Object-oriented functionality using Newton, so you know when to destroy an object that represents a body.
Parameters
- const NewtonBody* body - pointer to the body that was destroyed.
Remarks
- This is not a library function, but a callback event.
Example
void NewtonBodyDestroyCallback( const NewtonBody* body ) { MyEngine::VisObj* theobj = (MyEngine::VisObj*)NewtonBodyGetUserData( body ); // delete the visual object for this body delete theobj; }