Box2D::b2BodyDef - Holds all the data needed to construct a rigid body.
my $body_def = Box2D::b2BodyDef->new(); $body_def->type( Box2D::b2_dynamicBody ); $body_def->position->Set( $x, $y ); $body_def->angle( $theta ); my $body = $world->CreateBody( $body_def );
A body definition holds all the data needed to construct a rigid body. You can safely re-use body definitions. Shapes are added to a body after construction.
This constructor sets the body definition default values.
Returns a Box2D::b2BodyDef
Box2D::b2BodyDef
Does this body start out active?
Parameters:
bool $active (optional)
bool
$active
Returns a bool
Set this flag to false if this body should never fall asleep. Note that this increases CPU usage.
bool $allowSleep (optional)
$allowSleep
The world angle of the body in radians.
float32 $angle (optional)
float32
$angle
Returns a float32
Angular damping is use to reduce the angular velocity. The damping parameter can be larger than 1.0f but the damping effect becomes sensitive to the time step when the damping parameter is large.
float32 $angularDamping (optional)
$angularDamping
The angular velocity of the body.
float32 $angularVelocity (optional)
$angularVelocity
Is this body initially awake or sleeping?
bool $awake (optional)
$awake
Is this a fast moving body that should be prevented from tunneling through other moving bodies? Note that all bodies are prevented from tunneling through kinematic and static bodies. This setting is only considered on dynamic bodies.
Warning: You should use this flag sparingly since it increases processing time.
bool $bullet (optional)
$bullet
Should this body be prevented from rotating? Useful for characters.
bool $fixedRotation (optional)
$fixedRotation
Linear damping is use to reduce the linear velocity. The damping parameter can be larger than 1.0f but the damping effect becomes sensitive to the time step when the damping parameter is large.
float32 $linearDamping (optional)
$linearDamping
The linear velocity of the body's origin in world co-ordinates.
Box2D::b2Vec2 $linearVelocity (optional)
Box2D::b2Vec2
$linearVelocity
Returns a Box2D::b2Vec2
The world position of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes.
Box2D::b2Vec2 $position (optional)
$position
The body type: Box2D::b2_staticBody, Box2D::b2_kinematicBody, or Box2D::b2_dynamicBody.
Box2D::b2_staticBody
Box2D::b2_kinematicBody
Box2D::b2_dynamicBody
Note: if a dynamic body would have zero mass, the mass is set to one.
Box2D::b2BodyType $type (optional)
Box2D::b2BodyType
$type
Returns a Box2D::b2BodyType
Use this to store application specific body data.
scalar $userData (optional)
scalar
$userData
Returns a scalar
Box2D
Box2D::b2Body
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.