APIdia Launch Partner
Top Description Methods
com.badlogic.gdx.physics.box2d

public Interface RayCastCallback

Imports
com.badlogic.gdx.math.Vector2

Callback class for ray casts.
Author
mzechner
See Also
World#rayCast(RayCastCallback, Vector2, Vector2)

Method Summary

Modifier and TypeMethod and Description
public float

Returns:

-1 to filter, 0 to terminate, fraction to clip the ray for closest hit, 1 to continue
reportRayFixture
(Fixture
the fixture hit by the ray
fixture
,
Vector2
the point of initial intersection
point
,
Vector2
the normal vector at the point of intersection
normal
,
float fraction)

Called for each fixture found in the query.

Method Detail

reportRayFixtureback to summary
public float reportRayFixture(Fixture fixture, Vector2 point, Vector2 normal, float fraction)

Called for each fixture found in the query. You control how the ray cast proceeds by returning a float: return -1: ignore this fixture and continue return 0: terminate the ray cast return fraction: clip the ray to this point return 1: don't clip the ray and continue. The Vector2 instances passed to the callback will be reused for future calls so make a copy of them!

Parameters
fixture:Fixture

the fixture hit by the ray

point:Vector2

the point of initial intersection

normal:Vector2

the normal vector at the point of intersection

Returns:float

-1 to filter, 0 to terminate, fraction to clip the ray for closest hit, 1 to continue