@modoki/engine / index / Joint2D
Variable: Joint2D
constJoint2D:Trait<{anchorAX:number;anchorAY:number;anchorBX:number;anchorBY:number;axisX:number;axisY:number;damping:number;entityA:string;entityB:string;length:number;limitMax:number;limitMin:number;limitsEnabled:boolean;motorDamping:number;motorEnabled:boolean;motorStiffness:number;motorTargetPos:number;motorTargetVel:number;stiffness:number;type:JointType2D; }>
A constraint between two RigidBody2D entities. Attach Joint2D to a THIRD entity (or either body) — it is not a body itself, just a link record. entityA/ entityB are GUIDs (like BoneAttachment.target); the joint activates once both resolve to bodies. Anchors are local offsets (world units) on each body.
Unit notes (converted to Rapier's frame by physics2DJoints):
- anchors/axis: world units, Y-down (flipped like Transform).
length: world units (spring rest / rope max).- revolute motor/limit values are ANGLES (radians); prismatic ones are DISTANCES (world units) along the axis.