Jeffrey T. Palmer > Box2D > Box2D::b2BodyDef

Download:
Box2D-0.07.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

Box2D::b2BodyDef - Holds all the data needed to construct a rigid body.

SYNOPSIS ^

  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 );

DESCRIPTION ^

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.

METHODS ^

new()

This constructor sets the body definition default values.

Returns a Box2D::b2BodyDef

active()

active( $active )

Does this body start out active?

Parameters:

Returns a bool

allowSleep()

allowSleep( $allowSleep )

Set this flag to false if this body should never fall asleep. Note that this increases CPU usage.

Parameters:

Returns a bool

angle()

angle( $angle )

The world angle of the body in radians.

Parameters:

Returns a float32

angularDamping()

angularDamping( $angularDamping )

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.

Parameters:

Returns a float32

angularVelocity()

angularVelocity( $angularVelocity )

The angular velocity of the body.

Parameters:

Returns a float32

awake()

awake( $awake )

Is this body initially awake or sleeping?

Parameters:

Returns a bool

bullet()

bullet( $bullet )

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.

Parameters:

Returns a bool

fixedRotation()

fixedRotation( $fixedRotation )

Should this body be prevented from rotating? Useful for characters.

Parameters:

Returns a bool

linearDamping()

linearDamping( $linearDamping )

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.

Parameters:

Returns a float32

linearVelocity()

linearVelocity( $linearVelocity )

The linear velocity of the body's origin in world co-ordinates.

Parameters:

Returns a Box2D::b2Vec2

position()

position( $position )

The world position of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes.

Parameters:

Returns a Box2D::b2Vec2

type()

type( $type )

The body type: Box2D::b2_staticBody, Box2D::b2_kinematicBody, or Box2D::b2_dynamicBody.

Note: if a dynamic body would have zero mass, the mass is set to one.

Parameters:

Returns a Box2D::b2BodyType

userData()

userData( $userData )

Use this to store application specific body data.

Parameters:

Returns a scalar

SEE ALSO ^

BUGS ^

See "BUGS" in Box2D

AUTHORS ^

See "AUTHORS" in Box2D

COPYRIGHT & LICENSE ^

See "COPYRIGHT & LICENSE" in Box2D

syntax highlighting: