LittleJS 1.28.0

Box2D

Box2dRevoluteJoint

Box2D Revolute Joint

  • Constrains two objects to share a point while they are free to rotate around the point
  • The relative rotation about the shared point is the joint angle
  • You can limit the relative rotation with a joint limit
  • You can use a motor to drive the relative rotation about the shared point
  • A maximum motor torque is provided so that infinite forces are not generated

Extends Box2dJoint

Extended by Box2dPinJoint

Constructor

new Box2dRevoluteJoint(objectA, objectB, anchor, collide)box2d.js:1617

Create a revolute joint

objectA Box2dObject
objectB Box2dObject
anchor Vector2 optional

World position, objectB's position if not given

collide boolean optional, default false

Methods

Inherited from Box2dJoint

Methods

enableLimit(enable)box2d.js:1665

Enable/disable the joint limit

enable boolean optional, default true
enableMotor(enable)box2d.js:1692

Enable/disable the joint motor

enable boolean optional, default true
getJointAngle() → numberbox2d.js:1653

Get the current joint angle, clockwise like angle

getJointSpeed() → numberbox2d.js:1657

Get the current joint angle speed in radians per second, clockwise like angle

getLocalAnchorA() → Vector2box2d.js:1641

Get the local anchor point relative to objectA's origin

getLocalAnchorB() → Vector2box2d.js:1645

Get the local anchor point relative to objectB's origin

getLowerLimit() → numberbox2d.js:1669

Get the lower joint limit, clockwise like angle

getMaxMotorTorque() → numberbox2d.js:1708

Get the most torque the motor can apply, a magnitude

getMotorSpeed() → numberbox2d.js:1700

Get the motor speed, clockwise like angle

getMotorTorque(time) → numberbox2d.js:1713

Get the motor torque over the last step, clockwise like angle

time number optional

The step length in seconds, the world steps by timeDelta

getReferenceAngle() → numberbox2d.js:1649

Get the reference angle, objectB angle minus objectA angle in the reference state

getUpperLimit() → numberbox2d.js:1673

Get the upper joint limit, clockwise like angle

isLimitEnabled() → booleanbox2d.js:1661

Is the joint limit enabled?

isMotorEnabled() → booleanbox2d.js:1688

Is the joint motor enabled?

setLimits(min, max)box2d.js:1678

Set the joint limits, clockwise like angle

min number
max number
setMaxMotorTorque(torque)box2d.js:1704

Set the max motor torque, a magnitude

torque number
setMotorSpeed(speed)box2d.js:1696

Set the motor speed, clockwise like angle

speed number