++ed by:
1 non-PAUSE user
Tobias Leich
and 1 contributors

# NAME

Box2D::b2RevoluteJointDef - Revolute joint definition.

# SYNOPSIS

my \$joint_def = Box2D::b2RevoluteJointDef->new();
\$joint_def->Initialize( \$body_a, \$body_b, \$anchor );
my \$joint = \$world->CreateJoint( \$joint_def );

# DESCRIPTION

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.

# METHODS

## new()

Default constructor.

Returns a Box2D::b2RevoluteJointDef

## Initialize( \$bodyA, \$bodyB, \$anchor )

Initialize the bodies, anchors, and reference angle using a world anchor point.

Parameters:

• Box2D::b2Body \$bodyA

• Box2D::b2Body \$bodyB

• Box2D::b2Vec2 \$anchor

## enableLimit( \$enableLimit )

A flag to enable joint limits.

Parameters:

• bool \$enableLimit (optional)

Returns a bool

## enableMotor( \$enableMotor )

A flag to enable the joint motor.

Parameters:

• bool \$enableMotor (optional)

Returns a bool

## localAnchorA( \$localAnchorA )

The local anchor point relative to body1's origin.

Parameters:

• Box2D::b2Vec2 \$localAnchorA (optional)

Returns a Box2D::b2Vec2

## localAnchorB( \$localAnchorB )

The local anchor point relative to body2's origin.

Parameters:

• Box2D::b2Vec2 \$localAnchorB (optional)

Returns a Box2D::b2Vec2

## lowerAngle( \$lowerAngle )

The lower angle for the joint limit (radians).

Parameters:

• float32 \$lowerAngle (optional)

Returns a float32

## maxMotorTorque( \$maxMotorTorque )

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

Parameters:

• float32 \$maxMotorTorque (optional)

Returns a float32

## motorSpeed( \$motorSpeed )

The desired motor speed. Usually in radians per second.

Parameters:

• float32 \$motorSpeed (optional)

Returns a float32

## referenceAngle( \$referenceAngle )

The body2 angle minus body1 angle in the reference state (radians).

Parameters:

• float32 \$referenceAngle (optional)

Returns a float32

## upperAngle( \$upperAngle )

The upper angle for the joint limit (radians).

Parameters:

• float32 \$upperAngle (optional)

Returns a float32