@ue-too/dynamics / index / PinJoint
クラス: PinJoint
Pin joint connecting two bodies together.
Remarks
Connects two bodies at specified anchor points. The bodies can rotate relative to each other around the joint.
Useful for creating chains, ragdolls, and mechanical linkages.
例
Create a chain
typescript
const link1 = new Circle({ x: 0, y: 0 }, 10);
const link2 = new Circle({ x: 30, y: 0 }, 10);
const joint = new PinJoint(
link1,
link2,
{ x: 10, y: 0 }, // Right edge of link1
{ x: -10, y: 0 } // Left edge of link2
);
world.addRigidBody('link1', link1);
world.addRigidBody('link2', link2);
world.addConstraint(joint);実装
コンストラクター
コンストラクター
new PinJoint(
bodyA,bodyB,anchorA,anchorB):PinJoint
パラメータ
bodyA
bodyB
anchorA
Point
anchorB
Point
戻り値
PinJoint
メソッド
enforce()
enforce(
dt):void
Enforces the constraint for one timestep.
パラメータ
dt
number
Timestep in seconds
戻り値
void
の実装
solvePinJointConstraint()
solvePinJointConstraint(
dt):void
パラメータ
dt
number
戻り値
void