I've two Vector2 (A and B), i draw a line between them.
Is there a way to check if the line intersect the Box2D CircleShape? I need to a boolean output
I've two Vector2 (A and B), i draw a line between them.
Is there a way to check if the line intersect the Box2D CircleShape? I need to a boolean output
You should use World#rayCast(callback, fromPoint, toPoint)
to raycast the line.
callback = new RayCastCallback() {
@Override
public float reportRayFixture(Fixture fixture, Vector2 point, Vector2 normal, float fraction) {
// Do stuff here
}
};
world.rayCast(callback, point1, point2);