Defined in:Called when a new contact is made with another rigid body.
virtual RigidBodyStatus HandleNewRigidBodyContact(const RigidBodyContact *contact, RigidBodyController *contactBody);
||The new contact.|
||The rigid body with which contact was made.|
HandleNewRigidBodyContactfunction is called by the Physics Manager when a rigid body makes a new contact with another rigid body. This function can be overridden in a subclass of
RigidBodyControllerin order to carry out a specialized response to a collision.
contactparameter specifies the newly created
RigidBodyContactobject, which is an edge in the contact graph maintained by the Physics Manager. The rigid body for which the
HandleNewRigidBodyContactfunction is called can be either the start element or finish element for this edge. The
contactBodyparameter specifies the other rigid body involved in the new contact, which is always on the opposite end of the contact edge relative to the rigid body for which the
HandleNewRigidBodyContactfunction is called.
When a collision occurs between two rigid bodies, the
HandleNewRigidBodyContactfunction is called once for each rigid body. The order of the two calls is not defined, so any overridden function should not depend on the
HandleNewRigidBodyContactfunction being called for the start element of the
contactparameter before the finish element or vice-versa.
HandleNewRigidBodyContactfunction can call the
RigidBodyContact::GetWorldContactPositionfunction to obtain the world-space position and normal corresponding to one of the rigid bodies involving in the contact.
HandleNewRigidBodyContactfunction should return one of the following constants.
||No change was made to the rigid body or its contacts.|
||One or more contacts with the rigid body were broken or may have been broken.|
||The rigid body was destroyed.|
HandleNewRigidBodyContactfunction is allowed to destroy the contact specified by the
contactparameter using the
deleteoperator. In this case, the function must return
The default implementation of the
HandleNewRigidBodyContactfunction calls the