# NAME

Box2D::b2PrismaticJoint - Provides one degree of freedom: translation along an axis.

# SYNOPSIS

``````  my \$joint = \$world->CreateJoint( \$joint_def );
\$joint->EnableMotor( 1 );
\$joint->SetMaxMotorForce( \$max_force );``````

# DESCRIPTION

A prismatic joint. This joint provides one degree of freedom: translation along an axis fixed in body1. Relative rotation is prevented. You can use a joint limit to restrict the range of motion and a joint motor to drive the motion or to model joint friction.

# 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`

## GetJointSpeed()

Get the current joint translation speed, usually in meters per second.

Returns a `float32`

## GetJointTranslation()

Get the current joint translation, usually in meters.

Returns a `float32`

## GetLowerLimit()

Get the lower joint limit, usually in meters.

Returns a `float32`

## GetMotorForce()

Get the current motor force, usually in N.

Returns a `float32`

## GetMotorSpeed()

Get the motor speed, usually in meters per second.

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, usually in meters.

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, usually in meters.

Parameters:

• `float32` `\$lower`

• `float32` `\$upper`

## SetMaxMotorForce( \$force )

Set the maximum motor force, usually in N.

Parameters:

• `float32` `\$force`

## SetMotorSpeed( \$speed )

Set the motor speed, usually in meters per second.

Parameters:

• `float32` `\$speed`