0
\$\begingroup\$

These 2 polygons are not colliding, though this method returns true:

Intersector.overlapConvexPolygons(
            new float[]{
                        100.0f, 750.0f, 
                        200.0f, 750.0f, 
                        100.0f, 150.0f, 
                        200.0f, 150.0f
                        },
            new float[]{
                        77.0f, 695.0f, 
                        91.0f, 695.0f, 
                        84.0f, 681.0f
                        },
            null);

Am I using it correctly?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

The first polygon is not convex, swapping vertex 3 and 4 solved the problem

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Then please mark you answer as final (the green check icon). \$\endgroup\$ Apr 5, 2014 at 13:55
  • \$\begingroup\$ Is there any documentation that mentions the specific order that you need to define your verticies in? \$\endgroup\$
    – ashes999
    Apr 5, 2014 at 14:42
  • \$\begingroup\$ I need to wait 2 days until I can mark my own answer as the correct one. \$\endgroup\$
    – cahen
    Apr 5, 2014 at 18:56
  • \$\begingroup\$ @ashes999, you need to enter in the same order you would if you were drawing it with a pen, but of course this doesn't guarantee it's convex \$\endgroup\$
    – cahen
    Apr 5, 2014 at 18:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .