Everybody in my game world has fixtures with sensor shapes attached. When I raycast, it hits these fixtures, but I only want to hit fixtures with at least one shape that is not a sensor. Is this possible?
I'm using Box2dx - the C# port.
Also, what does the callback do?
world.PhysicsWorld.RayCast((f, p, n, fr) =>
{
fixture = f;
position = p;
return fr;
}, point1, point2);
This is the raycast function I'm calling. The documentation says that the callback can be used to specify the number of shapes to get back, but I'm not sure how to do that:
/// Ray-cast the world for all fixtures in the path of the ray. Your callback
/// controls whether you get the closest point, any point, or n-points.
/// The ray-cast ignores shapes that contain the starting point.
/// @param callback a user implemented callback class.
/// @param point1 the ray starting point
/// @param point2 the ray ending point
public void RayCast(Func<Fixture, Vector2, Vector2, float, float> callback, Vector2 point1, Vector2 point2)
{
RayCastInput input = new RayCastInput();
input.maxFraction = 1.0f;
input.p1 = point1;
input.p2 = point2;
_rayCastCallback = callback;
_contactManager._broadPhase.RayCast(_rayCastCallbackWrapper, ref input);
_rayCastCallback = null;
}