A lightweight b2RayCastCallback proxy.
This class allows us to replace the listener class with a modern closure.
float32 RaycastProxy::ReportFixture |
( |
b2Fixture * |
fixture, |
|
|
const b2Vec2 & |
point, |
|
|
const b2Vec2 & |
normal, |
|
|
float32 |
fraction |
|
) |
| |
|
inlineoverride |
Called for each fixture found in the query.
This callback controls how the ray cast proceeds by returning a float. If -1, it ignores this fixture and continues. If 0, it terminates the ray cast. If 1, it does not clip the ray and continues. Finally, for any fraction, it clips the ray at that point.
- Parameters
-
fixture | the fixture hit by the ray |
point | the point of initial intersection |
normal | the normal vector at the point of intersection |
faction | the fraction to return |
- Returns
- -1 to filter, 0 to terminate, fraction to clip the ray, 1 to continue
std::function<float(b2Fixture* fixture, const Vec2& point, const Vec2& normal, float fraction)> RaycastProxy::onQuery |
Called for each fixture found in the query.
This callback controls how the ray cast proceeds by returning a float. If -1, it ignores this fixture and continues. If 0, it terminates the ray cast. If 1, it does not clip the ray and continues. Finally, for any fraction, it clips the ray at that point.
- Parameters
-
fixture | the fixture hit by the ray |
point | the point of initial intersection |
normal | the normal vector at the point of intersection |
faction | the fraction to return |
- Returns
- -1 to filter, 0 to terminate, fraction to clip the ray, 1 to continue