Jeffrey T. Palmer > Box2D-0.07 > Box2D::b2Fixture

Download:
Box2D-0.07.tar.gz

Annotate this POD

View/Report Bugs
Source  

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:

SetFriction( $friction )

Set the coefficient of friction.

Parameters:

SetRestitution( $restitution )

Set the coefficient of restitution.

Parameters:

SetSensor( $sensor )

Set if this fixture is a sensor.

Parameters:

SetUserData( $data )

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

Parameters:

TestPoint( $p )

Test a point for containment in this fixture.

Parameters:

Returns a bool

SEE ALSO ^

BUGS ^

See "BUGS" in Box2D

AUTHORS ^

See "AUTHORS" in Box2D

COPYRIGHT & LICENSE ^

See "COPYRIGHT & LICENSE" in Box2D

syntax highlighting: