API Documentation for:
Show:

b2RevoluteJointDef Class

Extends B2JointDef
Defined in: b2RevoluteJointDef:18
Module: Joints

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.

Constructor

b2RevoluteJointDef

()

Methods

initialize

(
  • bodyA
  • bodyB
  • anchor
)
Void public

Defined in initialize:188

Parameters:

  • bodyA B2Body
  • bodyB B2Body
  • anchor B2Vec2

Returns:

Void:

Properties

enableMotor

Boolean public

Defined in enableMotor:108

A flag to enable the joint motor.

Default: false

localAnchorA

B2Vec2 public

Defined in localAnchorA:60

The local anchor point relative to bodyA's origin.

localAnchorB

B2Vec2 public

Defined in localAnchorB:69

The local anchor point relative to bodyB's origin.

lowerAngle

Boolean public

Defined in lowerAngle:98

A flag to enable joint limits.

Default: false

lowerAngle

Float public

Defined in lowerAngle:118

The lower angle for the joint limit (radians).

Default: 0.0

maxMotorTorque

Float public

Defined in maxMotorTorque:138

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

Default: 0.0

motorSpeed

Float public

Defined in motorSpeed:149

The desired motor speed. Usually in radians per second.

Default: 0.0

referenceAngle

Float public

Defined in referenceAngle:87

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

Default: 0.0

type

Int public

Defined in type:80

upperAngle

Float public

Defined in upperAngle:128

The upper angle for the joint limit (radians).

Default: 0.0