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

NAME

Box2D::b2Shape - Used for collision detection.

SYNOPSIS

  # Don't use this class directly, use a subclass.

DESCRIPTION

A shape is used for collision detection. You can create a shape however you like. Shapes used for simulation in Box2D::b2World are created automatically when a Box2D::b2Fixture is created.

METHODS

ComputeAABB( $aabb, $xf )

Given a transform, compute the associated axis aligned bounding box for this shape.

Parameters:

  • Box2D::b2AABB $aabb - returns the axis aligned box.

  • Box2D::b2Transform $xf - the world transform of the shape.

Implemented in Box2D::b2CircleShape, and Box2D::b2PolygonShape.

ComputeMass( $massData, $density )

Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin.

Parameters:

  • Box2D::b2MassData $massData - returns the mass data for this shape.

  • float32 $density - the density in kilograms per meter squared.

Implemented in Box2D::b2CircleShape, and Box2D::b2PolygonShape.

GetType()

Get the type of this shape. You can use this to down cast to the concrete shape.

Parameters:

Returns a int

RayCast( $output, $input, $transform )

Cast a ray against this shape.

Parameters:

  • Box2D::b2RayCastOutput $output - the ray-cast results.

  • Box2D::b2RayCastInput $input - the ray-cast input parameters.

  • Box2D::b2Transform $transform - the transform to be applied to the shape.

Returns a bool

Implemented in Box2D::b2CircleShape, and Box2D::b2PolygonShape.

TestPoint( $xf, $p )

Test a point for containment in this shape. This only works for convex shapes.

Parameters:

  • Box2D::b2Transform $xf - the shape world transform.

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

Returns a bool

Implemented in Box2D::b2CircleShape, and Box2D::b2PolygonShape.

m_radius()

m_radius( $m_radius )

Parameters:

  • float32 $m_radius (optional)

Returns a float32

m_type()

m_type( $m_type )

Parameters:

  • int $m_type (optional)

Returns a int

SEE ALSO

BUGS

See "BUGS" in Box2D

AUTHORS

See "AUTHORS" in Box2D

COPYRIGHT & LICENSE

See "COPYRIGHT & LICENSE" in Box2D