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.
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.