R3d.BallAndSocketJoint
Available since: Gideros 2019.10
Class: R3d.Joint
Description
The BallAndSocketJoint class describes a ball and socket joint between two bodies.
In a ball and socket joint, the two bodies cannot translate with respect to each other. However, they can rotate freely around a common anchor point. This joint has three degrees of freedom and can be used to simulate a chain of bodies for instance.
In order to create a ball and socket joint, you first need to create an instance of the BallAndSocketJointInfo class with the necessary information. You need to provide the pointers to the two rigid bodies and also the coordinates of the anchor point (in world-space). At the joint creation, the world-space anchor point will be converted into the local-space of the two rigid bodies and then, the joint will make sure that the two local-space anchor points match in world-space. Therefore, the two bodies need to be in a correct position at the joint creation.
r3d.BallAndSocketJoint
Now, it is time to create the actual joint in the dynamics world using the Dynamics World::createJoint() method. Note that this method will also return a pointer to the BallAndSocketJoint object that has been created internally. You will then be able to use that pointer to change properties of the joint and also to destroy it at the end.
Example