NAME
Box2D::b2RayCastCallback - Callback class for ray casts
SYNOPSIS
package My::RayCastCallback;
use parent qw(Box2D::b2RayCastCallback);
sub ReportFixture {
my ( $self, $fixture, $point, $normal, $fraction ) = @_;
// Do something
}
1;
DESCRIPTION
Callback class for ray casts. See "RayCast" in Box2D::b2World.
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!
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:
-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
Report bugs at https://github.com/PerlGameDev/Box2D-perl/issues
AUTHORS
COPYRIGHT & LICENSE
See "COPYRIGHT & LICENSE" in Box2D