The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Box2D::b2Fixture - Used to attach a shape to a body for collision detection.

SYNOPSIS

  my $fixture = $body->CreateFixture( $shape, $density );

DESCRIPTION

A fixture is used to attach a shape to a body for collision detection. A fixture inherits its transform from its parent. Fixtures hold additional non-geometric data such as friction, collision filters, etc. Fixtures are created via Box2D::b2Body::CreateFixture.

Warning: you cannot reuse fixtures.

METHODS

GetBody()

Get the parent body of this fixture. This is NULL if the fixture is not attached.

Returns a Box2D::b2Body - the parent body.

GetDensity()

Get the density of this fixture.

Returns a float32

GetFriction()

Get the coefficient of friction.

Returns a float32

GetNext()

Get the next fixture in the parent body's fixture list.

Returns a Box2D::b2Fixture - the next shape.

GetRestitution()

Get the coefficient of restitution.

Returns a float32

GetShape()

Get the child shape. You can modify the child shape, however you should not change the number of vertices because this will crash some collision caching mechanisms. Manipulating the shape may lead to non-physical behavior.

Returns a Box2D::b2Shape

GetUserData()

Get the user data that was assigned in the fixture definition. Use this to store your application specific data.

Returns a scalar

IsSensor()

Is this fixture a sensor (non-solid)?

Returns a bool - the true if the shape is a sensor.

SetDensity( $density )

Set the density of this fixture. This will _not_ automatically adjust the mass of the body. You must call Box2D::b2Body::ResetMassData to update the body's mass.

Parameters:

  • float32 $density

SetFriction( $friction )

Set the coefficient of friction.

Parameters:

  • float32 $friction

SetRestitution( $restitution )

Set the coefficient of restitution.

Parameters:

  • float32 $restitution

SetSensor( $sensor )

Set if this fixture is a sensor.

Parameters:

  • bool $sensor

SetUserData( $data )

Set the user data. Use this to store your application specific data.

Parameters:

  • scalar $data

TestPoint( $p )

Test a point for containment in this fixture.

Parameters:

  • Box2D::b2Vec2 $p - a point in world coordinates.

Returns a bool

SEE ALSO

BUGS

See "BUGS" in Box2D

AUTHORS

See "AUTHORS" in Box2D

COPYRIGHT & LICENSE

See "COPYRIGHT & LICENSE" in Box2D