The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

=head1 NAME

Box2D::b2PrismaticJointDef - Prismatic joint definition.

=head1 SYNOPSIS

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

=head1 DESCRIPTION

Prismatic joint definition. This requires defining a line of motion
using an axis and an anchor point. The definition uses local anchor
points and a local axis so that the initial configuration can violate
the constraint slightly. The joint translation is zero when the local
anchor points coincide in world space. Using local anchors and a local
axis helps when saving and loading a game.

Warning: at least one body should by dynamic with a non-fixed rotation.

=head1 METHODS

=head2 new()

Default constructor.

Returns a C<Box2D::b2PrismaticJointDef>

=head2 Initialize( $bodyA, $bodyB, $anchor, $axis )

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

Parameters:

=over 4

=item * C<Box2D::b2Body> C<$bodyA>

=item * C<Box2D::b2Body> C<$bodyB>

=item * C<Box2D::b2Vec2> C<$anchor>

=item * C<Box2D::b2Vec2> C<$axis>

=back

=head2 enableLimit()

=head2 enableLimit( $enableLimit )

Enable/disable the joint limit.

Parameters:

=over 4

=item * C<bool> C<$enableLimit> (optional)

=back

Returns a C<bool>

=head2 enableMotor()

=head2 enableMotor( $enableMotor )

Enable/disable the joint motor.

Parameters:

=over 4

=item * C<bool> C<$enableMotor> (optional)

=back

Returns a C<bool>

=head2 localAnchorA()

=head2 localAnchorA( $localAnchorA )

The local anchor point relative to body1's origin.

Parameters:

=over 4

=item * C<Box2D::b2Vec2> C<$localAnchorA> (optional)

=back

Returns a C<Box2D::b2Vec2>

=head2 localAnchorB()

=head2 localAnchorB( $localAnchorB )

The local anchor point relative to body2's origin.

Parameters:

=over 4

=item * C<Box2D::b2Vec2> C<$localAnchorB> (optional)

=back

Returns a C<Box2D::b2Vec2>

=head2 localAxis1()

=head2 localAxis1( $localAxis1 )

The local translation axis in body1.

Parameters:

=over 4

=item * C<Box2D::b2Vec2> C<$localAxis1> (optional)

=back

Returns a C<Box2D::b2Vec2>

=head2 lowerTranslation()

=head2 lowerTranslation( $lowerTranslation )

The lower translation limit, usually in meters.

Parameters:

=over 4

=item * C<float32> C<$lowerTranslation> (optional)

=back

Returns a C<float32>

=head2 maxMotorForce()

=head2 maxMotorForce( $maxMotorForce )

The maximum motor torque, usually in N-m.

Parameters:

=over 4

=item * C<float32> C<$maxMotorForce> (optional)

=back

Returns a C<float32>

=head2 motorSpeed()

=head2 motorSpeed( $motorSpeed )

The desired motor speed in radians per second.

Parameters:

=over 4

=item * C<float32> C<$motorSpeed> (optional)

=back

Returns a C<float32>

=head2 referenceAngle()

=head2 referenceAngle( $referenceAngle )

The constrained angle between the bodies: body2_angle - body1_angle.

Parameters:

=over 4

=item * C<float32> C<$referenceAngle> (optional)

=back

Returns a C<float32>

=head2 upperTranslation()

=head2 upperTranslation( $upperTranslation )

The upper translation limit, usually in meters.

Parameters:

=over 4

=item * C<float32> C<$upperTranslation> (optional)

=back

Returns a C<float32>

=head1 SEE ALSO

=over 4

=item * L<Box2D>

=item * L<Box2D::b2PrismaticJoint>

=item * L<Box2D::b2JointDef>

=item * L<Box2D::b2World>

=back

=head1 BUGS

See L<Box2D/BUGS>

=head1 AUTHORS

See L<Box2D/AUTHORS>

=head1 COPYRIGHT & LICENSE

See L<Box2D/"COPYRIGHT & LICENSE">

=cut