Joints
When we need to connect two bodies together in Box2D, we use joints. Joints always connect two bodies and never more. Multiple joints are then required to link more bodies together. A joint always connects a dynamic body with another body that can be either static, kinematic, or dynamic. Joints between kinematic and static bodies are allowed but have no effect.
Note
Joints update the body positions and rotations based on the type of joint. You can define two bodies in an arbitrary location and rotation, but if the joint restricts the position, for example, the bodies will immediately transform to the proper position after the simulation starts.
A joint can also specify whether the connected bodies should collide or not. We are going to see the basic joints available in Box2D, and we are going to implement one of them.
The revolute joint
The revolute joint is like a pin or hinge. Imagine that you cut two bodies from some paper and pin them together. The pin hole in the first body is the...