B2Joint

From Box2D Wiki

b2Joint
Box2D/Dynamics/Joints
Visibility Public
Definition Object b2JointDef
Children See article
Manual reference [1]
API reference [2]
Source reference H.png Cpp.png

Joints constrain the relative motions of pairs of objects. There are several types of joints available in Box2d:

  • b2RevoluteJoint - attaches two objects by "pinning" them together at an anchor point which they may revolve around
  • b2DistanceJoint - constrains two objects so that the distance between the two anchor points is constant
  • b2PrismaticJoint - allows movement only along one axis, like a piston
  • b2GearJoint - connects a combination of revolute and prismatic joints, allowing gears to be simulated. Note that the revolute/prismatic joints must be anchored to the ground to work with a gear joint, created with the ground as body1.
  • b2PulleyJoint - creates a pulley setup, where the sum of the distances (or some weighting thereof) of two bodies to the world anchor points must be a constant
  • b2MouseJoint - a damped spring anchored to a given world point, used in the testbed to allow mouse dragging of objects

All of the preceding inherit from the b2Joint superclass - see b2Joint.cpp and b2Joint.h.

Joints are described in detail in the manual.

Joints
Box2d Joints

Revolute Joint • Distance Joint • Prismatic Joint • Gear Joint • Pulley Joint • Mouse Joint

Unofficial joints

Weld joint • Hooke Spring


TOOLBOX
LANGUAGES