public static bool Collided(Broadphase b1, Broadphase b2) { if (b1.X1 < b2.X2 && b1.X2 > b2.X1 && b1.Y1 < b2.Y2 && b1.Y2 > b2.Y1) { return(true); } else { return(false); } }
public bool PolygonCollide(Body bodyA, Body bodyB) { foreach (Poly polyA in bodyA.shapes) { foreach (Poly polyB in bodyB.shapes) { if (Broadphase.Collided(polyA.broadphase, polyB.broadphase)) { //PolygonCollisionResult r = PolygonCollision(polyA, polyB); //if (r.Intersect) if (PolygonCollision(polyA, polyB)) { return(true); } } } } return(false); }