Exemple #1
0
 public bool Intersects(BoundingCylinder other)
 {
     float h2 = Height / 2;
     float oh2 = other.Height / 2;
     return (Position.x + Radius < other.Position.x + other.Radius && Position.x + Radius > other.Position.x - other.Radius
         || Position.x - Radius > other.Position.x - other.Radius && Position.x + Radius < other.Position.x + other.Radius) &&
             (Position.z + Radius < other.Position.z + other.Radius && Position.z + Radius > other.Position.z - other.Radius
         || Position.z - Radius > other.Position.z - other.Radius && Position.z + Radius < other.Position.z + other.Radius) &&
             (Position.y + h2 < other.Position.y + oh2 && Position.y + h2 > other.Position.y - oh2
         || Position.y - h2 > other.Position.y - oh2 && Position.y + h2 < other.Position.y + oh2);
 }
Exemple #2
0
        public bool Intersects(BoundingCylinder other)
        {
            float h2  = Height / 2;
            float oh2 = other.Height / 2;

            return((Position.x + Radius < other.Position.x + other.Radius && Position.x + Radius > other.Position.x - other.Radius ||
                    Position.x - Radius > other.Position.x - other.Radius && Position.x + Radius < other.Position.x + other.Radius) &&
                   (Position.z + Radius < other.Position.z + other.Radius && Position.z + Radius > other.Position.z - other.Radius ||
                    Position.z - Radius > other.Position.z - other.Radius && Position.z + Radius < other.Position.z + other.Radius) &&
                   (Position.y + h2 < other.Position.y + oh2 && Position.y + h2 > other.Position.y - oh2 ||
                    Position.y - h2 > other.Position.y - oh2 && Position.y + h2 < other.Position.y + oh2));
        }