++ed by:

1 PAUSE user
1 non-PAUSE user.

Jeffrey T. Palmer
and 1 contributors

# NAME

Box2D::b2LineJoint - Provides two degrees of freedom: translation along an axis and rotation in the plane.

# SYNOPSIS

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

# DESCRIPTION

A line joint. This joint provides two degrees of freedom: translation along an axis fixed in body1 and rotation in the plane. 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`

## GetMaxMotorForce()

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/Get the maximum motor force, usually in N.

Parameters:

• `float32` `\$force`

## SetMotorSpeed( \$speed )

Set the motor speed, usually in meters per second.

Parameters:

• `float32` `\$speed`