Beispiel #1
0
 public static void CheckPollyPollyCollider(PollygonCollider object1, PollygonCollider object2)
 {
     if (IsPollygonsIntersecting(object1, object2))
     {
         object1.ApplyCollision(object2);
     }
 }
Beispiel #2
0
        public static void CheckPollyBoxCollider(PollygonCollider object1, BoxCollider object2)
        {
            Vector2[]        points       = new Vector2[] { new Vector2(object2.area.X, object2.area.Y), new Vector2(object2.area.X + object2.area.Width, object2.area.Y), new Vector2(object2.area.X + object2.area.Width, object2.area.Y + object2.area.Height), new Vector2(object2.area.X, object2.area.Y + object2.area.Height) };
            PollygonCollider object2Polly = new Models.PollyColliderObject(points, new Vector2(0, 0), null, Vector2.One);

            if (IsPollygonsIntersecting(object1, object2Polly))
            {
                object1.ApplyCollision(object2);
            }
        }