I have a polygon object composed of multiple fixtures (see attachment). My problem is that the Box2D raycasts which are hitting this object, behave unpredictable. For example, a raycast coming from below, usually stops at the outer edge (marked with the red dot), but sometimes it goes trough the first fixture and stops at the next one, marked by the yellow dot. Here is my raycast function:
Code: Select all
callbackRayCast = new RayCastCallback()
public float reportRayFixture(Fixture fixture, Vector2 point, Vector2 normal, float fraction)
I am always returning 0, to stop at the first fixture. Could you tell me, why it happens sometimes that the ray "ignores" the first fixture and it stops at the next one?
Any help is appreciated.