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

Get Learning AndEngine now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.