Skip to main content

Class: RevoluteJoint

Defined in: physics/joints/revolute-joint.ts:64

A constraint that pins two RigidBody instances together at a shared anchor point, locking both linear degrees of freedom while leaving relative rotation about that point free. Used for doors, pendulums, wheels, and other hinging mechanisms. Register with a PhysicsWorld via addJoint for it to be solved every PhysicsWorld.step.

Constructors

Constructor

new RevoluteJoint(options): RevoluteJoint

Defined in: physics/joints/revolute-joint.ts:90

Creates a new RevoluteJoint instance.

Parameters

options

RevoluteJointOptions

The options for the joint.

Returns

RevoluteJoint

Throws

An error if lowerAngle is greater than upperAngle.

Properties

bodyA

readonly bodyA: RigidBody

Defined in: physics/joints/revolute-joint.ts:65


bodyB

readonly bodyB: RigidBody

Defined in: physics/joints/revolute-joint.ts:67


enableLimit

enableLimit: boolean

Defined in: physics/joints/revolute-joint.ts:79


localAnchorA

readonly localAnchorA: Vector2

Defined in: physics/joints/revolute-joint.ts:69


localAnchorB

readonly localAnchorB: Vector2

Defined in: physics/joints/revolute-joint.ts:71


lowerAngle

lowerAngle: number

Defined in: physics/joints/revolute-joint.ts:81


referenceAngle

readonly referenceAngle: number

Defined in: physics/joints/revolute-joint.ts:77

The relative angle (bodyB.angle - bodyA.angle) at construction time, used as the zero point angle is measured from.


upperAngle

upperAngle: number

Defined in: physics/joints/revolute-joint.ts:83

Accessors

anchor

Get Signature

get anchor(): Vector2

Defined in: physics/joints/revolute-joint.ts:133

The world-space anchor point the joint pins the bodies together at, taken as the midpoint of each body's (generally coincident) anchor.

Returns

Vector2


angle

Get Signature

get angle(): number

Defined in: physics/joints/revolute-joint.ts:125

The relative angle between the bodies, measured from referenceAngle. Zero at construction time, increases as bodyB rotates further counter-clockwise relative to bodyA than it started.

Returns

number