Game Development Reference
In-Depth Information
F IGURE 17.3
Closeup of a ragdoll joint.
gether. Figure 17.3 shows a detail of one such joint. Note that the contact is keeping
two points together. The contact will always be between these two points, making sure
they align.
To prevent the contact from slipping further out of alignment, the friction at the
joint should be effectively infinite. To prevent the joint from bouncing out of align-
ment, the restitution should be zero.
In the code we have the following structure that holds information on one joint:
Excerpt from include/cyclone/joints.h
/**
* Joints link together two rigid bodies and make sure they do not
* separate. In a general physics engine there may be many
* different types of joint, which reduce the number of relative
* degrees of freedom between two objects. This joint is a common
* position joint: each object has a location (given in
* body coordinates) that will be kept at the same point in the
* simulation.
*/
class Joint : public ContactGenerator
{
public:
/**
* Holds the two rigid bodies that are connected by this joint.
*/
RigidBody* body[2];
/**
* Holds the relative location of the connection for each
* body, given in local coordinates.
*/
Vector3 position[2];
Search Nedrilad ::




Custom Search