Options
All
  • Public
  • Public/Protected
  • All
Menu

Revolute joint definition. This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game. The local anchor points are measured from the body's origin rather than the center of mass because: 1. you might not know where the center of mass will be. 2. if you add/remove shapes from a body and recompute the mass, the joints will be broken.

Hierarchy

Index

Constructors

constructor

Properties

bodyA

bodyA: b2Body

The first attached body.

bodyB

bodyB: b2Body

The second attached body.

collideConnected

collideConnected: boolean

Set this flag to true if the attached bodies should collide.

enableLimit

enableLimit: boolean

A flag to enable joint limits.

enableMotor

enableMotor: boolean

A flag to enable the joint motor.

localAnchorA

localAnchorA: b2Vec2

The local anchor point relative to body1's origin.

localAnchorB

localAnchorB: b2Vec2

The local anchor point relative to body2's origin.

lowerAngle

lowerAngle: number

The lower angle for the joint limit (radians).

maxMotorTorque

maxMotorTorque: number

The maximum motor torque used to achieve the desired motor speed. Usually in N-m.

motorSpeed

motorSpeed: number

The desired motor speed. Usually in radians per second.

referenceAngle

referenceAngle: number

The bodyB angle minus bodyA angle in the reference state (radians).

type

type: number

The joint type is set automatically for concrete joint types.

upperAngle

upperAngle: number

The upper angle for the joint limit (radians).

userData

userData: any

Use this to attach application specific data to your joints.

Methods

Initialize

  • Initialize the bodies, achors, and reference angle using the world anchor.

    Parameters

    Returns void

Generated using TypeDoc