Box2D::b2RevoluteJointDef - Revolute joint definition.
my $joint_def = Box2D::b2RevoluteJointDef->new(); $joint_def->Initialize( $body_a, $body_b, $anchor ); my $joint = $world->CreateJoint( $joint_def );
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:
you might not know where the center of mass will be.
if you add/remove shapes from a body and recompute the mass, the joints will be broken.
Default constructor.
Returns a Box2D::b2RevoluteJointDef
Box2D::b2RevoluteJointDef
Initialize the bodies, anchors, and reference angle using a world anchor point.
Parameters:
Box2D::b2Body $bodyA
Box2D::b2Body
$bodyA
Box2D::b2Body $bodyB
$bodyB
Box2D::b2Vec2 $anchor
Box2D::b2Vec2
$anchor
A flag to enable joint limits.
bool $enableLimit (optional)
bool
$enableLimit
Returns a bool
A flag to enable the joint motor.
bool $enableMotor (optional)
$enableMotor
The local anchor point relative to body1's origin.
Box2D::b2Vec2 $localAnchorA (optional)
$localAnchorA
Returns a Box2D::b2Vec2
The local anchor point relative to body2's origin.
Box2D::b2Vec2 $localAnchorB (optional)
$localAnchorB
The lower angle for the joint limit (radians).
float32 $lowerAngle (optional)
float32
$lowerAngle
Returns a float32
The maximum motor torque used to achieve the desired motor speed. Usually in N-m.
float32 $maxMotorTorque (optional)
$maxMotorTorque
The desired motor speed. Usually in radians per second.
float32 $motorSpeed (optional)
$motorSpeed
The body2 angle minus body1 angle in the reference state (radians).
float32 $referenceAngle (optional)
$referenceAngle
The upper angle for the joint limit (radians).
float32 $upperAngle (optional)
$upperAngle
Box2D
Box2D::b2RevoluteJoint
Box2D::b2JointDef
Box2D::b2World
See "BUGS" in Box2D
See "AUTHORS" in Box2D
See "COPYRIGHT & LICENSE" in Box2D
To install Box2D, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Box2D
CPAN shell
perl -MCPAN -e shell install Box2D
For more information on module installation, please visit the detailed CPAN module installation guide.