Box2D::b2RayCastCallback - Callback class for ray casts.
package My::RayCastCallback; use Box2D; use base qw(Box2D::b2RayCastCallback); sub ReportFixture { my ( $self, $fixture, $point, $normal, $fraction ) = @_; # Do something } 1;
Callback class for ray casts. See Box2D::b2World::RayCast.
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!
Box2D::b2RayCastCallback
Returns a Box2D::b2RayCastCallback
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 ray
Box2D::b2Fixture
$fixture
Box2D::b2Vec2 $point - the point of initial intersection
Box2D::b2Vec2
$point
Box2D::b2Vec2 $normal - the normal vector at the point of intersection
$normal
float32 $fraction - the fraction of the distance to the point of intersection
float32
$fraction
Returns a float32:
-1 - to ignore the fixture and continue
-1
0 - to terminate the ray cast
0
$fraction - to clip the ray for closest hit
1 - don't clip the ray and continue
1
See "BUGS" in Box2D
See "AUTHORS" in Box2D
See "COPYRIGHT & LICENSE" in Box2D
Box2D
Box2D::b2World
To install Box2D, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Box2D
CPAN shell
perl -MCPAN -e shell install Box2D
For more information on module installation, please visit the detailed CPAN module installation guide.