Type Function Library physics.* Return value Joint Revision Release 2024.3703 Keywords physics, joints, newJoint See also Physics Joints (guide)
Joints can be used to assemble complex physical objects from multiple rigid bodies. For example, joints can be used to join the limbs of a ragdoll figure, attach the wheels of a vehicle to its body, create a moving elevator platform, and more.
Most joints are used to connect two rigid physical bodies, so you must create these bodies first and then submit them as arguments to this constructor function, along with other properties that vary depending on the joint type.
See the Physics Joints guide to study the various joint types.
Some joints may be unstable due to the fact that Box2D uses continuous physics. You can turn this off using physics.setContinuous().
This call cannot be used in a collision event. However, your collision handler may set a flag or include a time delay via timer.performWithDelay() so that the action can occur in the next application cycle or later. See the Collision Detection guide for a complete list of which APIs and methods are subject to this rule.
physics.newJoint( jointType, ... )
joint:removeSelf() --OR: display.remove( joint )
Note that if one of the joined bodies is destroyed, the associated joint will be automatically destroyed. However, remember to properly remove and
nil any references to a joint which has been destroyed.