enter image description here

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() {
    public float reportRayFixture(Fixture fixture, Vector2 point, Vector2 normal, float fraction) {
        // Do stuff here
world.rayCast(callback, point1, point2);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.