++ed by:

1 PAUSE user
1 non-PAUSE user.

Tobias Leich
and 1 contributors

NAME

Box2D::b2RevoluteJoint - Constrains two bodies to share a common point.

SYNOPSIS

``````  my \$joint = \$world->CreateJoint( \$joint_def );
\$joint->EnableMotor( 1 );
\$joint->SetMaxMotorTorque( \$torque );
\$joint->SetMotorSpeed( \$speed );``````

DESCRIPTION

A revolute joint constrains two bodies to share a common point while they are free to rotate about the point. The relative rotation about the shared point is the joint angle. You can limit the relative rotation with a joint limit that specifies a lower and upper angle. 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.

METHODS

EnableLimit( \$flag )

Enable/disable the joint limit.

Parameters:

• `bool` `\$flag`

EnableMotor( \$flag )

Enable/disable the joint motor.

Parameters:

• `bool` `\$flag`

GetAnchorA()

Get the anchor point on bodyA in world coordinates. Implements `Box2D::b2Joint`.

Returns a `Box2D::b2Vec2`

GetAnchorB()

Get the anchor point on bodyB in world coordinates. Implements `Box2D::b2Joint`.

Returns a `Box2D::b2Vec2`

GetJointAngle()

Get the current joint angle in radians.

Returns a `float32`

GetJointSpeed()

Get the current joint angle speed in radians per second.

Returns a `float32`

GetLowerLimit()

Get the lower joint limit in radians.

Returns a `float32`

GetMotorSpeed()

Get the motor speed in radians per second.

Returns a `float32`

GetMotorTorque()

Get the current motor torque, usually in N-m.

Returns a `float32`

GetReactionForce( \$inv_dt )

Get the reaction force on body2 at the joint anchor in Newtons. Implements `Box2D::b2Joint`.

Parameters:

• `float32` `\$inv_dt`

Returns a `Box2D::b2Vec2`

GetReactionTorque( \$inv_dt )

Get the reaction torque on body2 in N*m. Implements `Box2D::b2Joint`.

Parameters:

• `float32` `\$inv_dt`

Returns a `float32`

GetUpperLimit()

Get the upper joint limit in radians.

Returns a `float32`

IsLimitEnabled()

Is the joint limit enabled?

Returns a `bool`

IsMotorEnabled()

Is the joint motor enabled?

Returns a `bool`

SetLimits( \$lower, \$upper )

Set the joint limits in radians.

Parameters:

• `float32` `\$lower`

• `float32` `\$upper`

SetMaxMotorTorque( \$torque )

Set the maximum motor torque, usually in N-m.

Parameters:

• `float32` `\$torque`

SetMotorSpeed( \$speed )

Set the motor speed in radians per second.

Parameters:

• `float32` `\$speed`