I am writing a game using libGDX and I need detection of polygons, but the Intersector.overlapConvexPolygons
method returns not at all what it should if it concerns complex shapes.
Based on this, what is the point of this method if it returns the same as the Rectangle check?
Maybe I'm doing something wrong?
public Vector getOverlap(Entity a, Entity b){
Vector v=new Vector(); //my implementation of Vector2 class
Intersector.MinimumTranslationVector mv=new Intersector.MinimumTranslationVector();
if(Intersector.overlapConvexPolygons(a.getBounds(), b.getBounds(), mv)){
v.set(mv.normal.x, mv.normal.y).scl(mv.depth);
}
return v;
}