Jeffrey T. Palmer > Box2D-0.07 > Box2D::b2RevoluteJointDef

Download:
Box2D-0.07.tar.gz

Annotate this POD

View/Report Bugs
Source  

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:

enableLimit()

enableLimit( $enableLimit )

A flag to enable joint limits.

Parameters:

Returns a bool

enableMotor()

enableMotor( $enableMotor )

A flag to enable the joint motor.

Parameters:

Returns a bool

localAnchorA()

localAnchorA( $localAnchorA )

The local anchor point relative to body1's origin.

Parameters:

Returns a Box2D::b2Vec2

localAnchorB()

localAnchorB( $localAnchorB )

The local anchor point relative to body2's origin.

Parameters:

Returns a Box2D::b2Vec2

lowerAngle()

lowerAngle( $lowerAngle )

The lower angle for the joint limit (radians).

Parameters:

Returns a float32

maxMotorTorque()

maxMotorTorque( $maxMotorTorque )

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

Parameters:

Returns a float32

motorSpeed()

motorSpeed( $motorSpeed )

The desired motor speed. Usually in radians per second.

Parameters:

Returns a float32

referenceAngle()

referenceAngle( $referenceAngle )

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

Parameters:

Returns a float32

upperAngle()

upperAngle( $upperAngle )

The upper angle for the joint limit (radians).

Parameters:

Returns a float32

SEE ALSO ^

BUGS ^

See "BUGS" in Box2D

AUTHORS ^

See "AUTHORS" in Box2D

COPYRIGHT & LICENSE ^

See "COPYRIGHT & LICENSE" in Box2D

syntax highlighting: