Пример #1
0
        /// <summary></summary>
        public static bool Collide(MeshCollider m1, MeshCollider m2)
        {
            Sphere s1 = new Sphere(m1.transform.position, 0);
            Sphere s2 = new Sphere(m2.transform.position, 0);

            foreach (Point pt in m1.GetVertices())
            {
                float d = DistanceUtil.Dist(pt, s1.position);
                if (d > s1.radius)
                {
                    s1.radius = d;
                }
            }
            foreach (Point pt in m2.GetVertices())
            {
                float d = DistanceUtil.Dist(pt, s2.position);
                if (d > s2.radius)
                {
                    s2.radius = d;
                }
            }
            if (!Collide(s1, s2))
            {
                return(false);
            }
            return(DistanceUtil.Dist(m1, m2) <= 0);
        }
Пример #2
0
 /// <summary></summary>
 public static bool Collide(SphereCollider s, Line l)
 {
     return(Collide(DistanceUtil.ToSphere(s), l));
 }
Пример #3
0
 /// <summary></summary>
 public static bool Collide(SphereCollider s, Point p)
 {
     return(Collide(DistanceUtil.ToSphere(s), p));
 }
Пример #4
0
 /// <summary></summary>
 public static bool Collide(Sphere s1, Sphere s2)
 {
     return(DistanceUtil.Dist(s1, s2) <= 0);
 }
Пример #5
0
 /// <summary></summary>
 public static bool Collide(Sphere s, Plane p)
 {
     return(DistanceUtil.Dist(s, p) <= 0);
 }
Пример #6
0
 /// <summary></summary>
 public static bool Collide(Sphere s, Line l)
 {
     return(DistanceUtil.Dist(s, l) <= 0);
 }
Пример #7
0
 /// <summary></summary>
 public static bool Collide(MeshCollider m, SphereCollider s)
 {
     return(Collide(m, DistanceUtil.ToSphere(s)));
 }
Пример #8
0
 /// <summary></summary>
 public static bool Collide(MeshCollider m, Point p)
 {
     return(DistanceUtil.Dist(m, p) <= 0);
 }
Пример #9
0
 /// <summary></summary>
 public static bool Collide(MeshCollider m, Sphere s)
 {
     return(DistanceUtil.Dist(m, s) <= 0);
 }
Пример #10
0
 /// <summary></summary>
 public static bool Collide(SphereCollider s, BoxCollider b)
 {
     return(Collide(DistanceUtil.ToSphere(s), b));
 }
Пример #11
0
 /// <summary></summary>
 public static bool Collide(BoxCollider b, Sphere s)
 {
     return(DistanceUtil.Dist(b, s) <= 0);
 }
Пример #12
0
 /// <summary></summary>
 public static bool Collide(BoxCollider b, Point p)
 {
     return(DistanceUtil.Dist(p, b.ClosestPoint(p)) < 0.000001);
 }
Пример #13
0
 /// <summary></summary>
 public static bool Collide(Point[] pts, Plane p)
 {
     return(DistanceUtil.Dist(pts, p) <= 0);
 }
Пример #14
0
 /// <summary></summary>
 public static bool Collide(SphereCollider s1, SphereCollider s2)
 {
     return(Collide(DistanceUtil.ToSphere(s2), DistanceUtil.ToSphere(s2)));
 }