Joint
Connects two physics bodies with a joint constraint. Both entities must have `Physics` components.
Joint
Connects two physics bodies with a joint constraint. Both entities must have Physics components.
Joint kinds: "fixed", "hinge", "ball", "prismatic", "spring", "rope".
Public fields: kind, connected, localAnchorX/Y/Z, remoteAnchorX/Y/Z, axisX/Y/Z, stiffness, damping, restLength, maxDistance.
Methods: :setMotor(targetVelocity, maxForce).
entity(id).component.add("Joint", {
connected = frameEntityId,
kind = "hinge",
axis = {0, 1, 0},
})
A "rope" joint is a hard maximum-distance limit solved inside the physics step: the bodies move freely while the anchors are closer than maxDistance (slack rope) and are stopped from separating beyond it (taut rope). It requires maxDistance > 0, and maxDistance is reactive — writing it on a live joint retunes the limit in place, so a winch can reel a rope in or out without recreating the joint.
entity(ballId).component.add("Joint", {
connected = hookEntityId,
kind = "rope",
maxDistance = 8,
})
Scoped to this part · feeds back into the world's score.