NAME
Box2D::b2RayCastCallback - Callback class for ray casts.
SYNOPSIS
package My::RayCastCallback;
use Box2D;
use base qw(Box2D::b2RayCastCallback);
sub ReportFixture {
my ( $self, $fixture, $point, $normal, $fraction ) = @_;
# Do something
}
1;
DESCRIPTION
Callback class for ray casts. See Box2D::b2World::RayCast.
METHODS
new()
Creates and returns a new Box2D::b2RayCastCallback
. This is an inheritance friendly sub so you're free to leave it as default. Remember to call super in your own code, don't forget to call this!
Returns a Box2D::b2RayCastCallback
ReportFixture( $fixture, $point, $normal, $fraction )
Called for each fixture found in the query. You control how the ray cast proceeds by returning a float.
Override this method in your subclass.
Parameters:
Box2D::b2Fixture
$fixture
- the fixture hit by the rayBox2D::b2Vec2
$point
- the point of initial intersectionBox2D::b2Vec2
$normal
- the normal vector at the point of intersectionfloat32
$fraction
- the fraction of the distance to the point of intersection
Returns a float32
:
-1
- to ignore the fixture and continue0
- to terminate the ray cast$fraction
- to clip the ray for closest hit1
- don't clip the ray and continue
BUGS
See "BUGS" in Box2D
AUTHORS
COPYRIGHT & LICENSE
See "COPYRIGHT & LICENSE" in Box2D