public bool NoContactCertainty(IConvex2D shape)
        {
            float minA = 0;
            float maxA = 0;
            float minB = 0;
            float maxB = 0;

            // Only check up & right normals for an AABB since down & left are the same axes

            shape.Project(Vector2.up, ref minA, ref maxA);
            this.Project(Vector2.up, ref minB, ref maxB);

            // Check if the polygon projections are currentlty NOT intersecting
            if (Utility.IntervalDistance(minA, maxA, minB, maxB) > 0)
            {
                return(true);
            }

            shape.Project(Vector2.right, ref minA, ref maxA);
            this.Project(Vector2.right, ref minB, ref maxB);

            // Check if the polygon projections are currentlty NOT intersecting
            if (Utility.IntervalDistance(minA, maxA, minB, maxB) > 0)
            {
                return(true);
            }

            return(false);
        }
        public bool NoContactCertainty(IConvex2D shape)
        {
            float minA = 0;
            float maxA = 0;
            float minB = 0;
            float maxB = 0;

            Vector2 normal = new Vector2(-(w.y - v.y), w.x - v.x).normalized;

            shape.Project(normal, ref minA, ref maxA);
            this.Project(normal, ref minB, ref maxB);

            // Check if the polygon projections are currentlty NOT intersecting
            if (Utility.IntervalDistance(minA, maxA, minB, maxB) > 0)
            {
                return(true);
            }

            return(false);
        }
예제 #3
0
 public void Project(Vector2 normal, ref float min, ref float max)
 {
     shape.Project(normal, ref min, ref max);
 }