TerrainDisplay.Collision.Intersection.IntersectMovingSpherePlane C# (CSharp) Method

IntersectMovingSpherePlane() public static method

public static IntersectMovingSpherePlane ( BoundingSphere s, System.Vector3 v, Plane p, float &t, System.Vector3 &q ) : bool
s BoundingSphere
v System.Vector3
p Plane
t float
q System.Vector3
return bool
        public static bool IntersectMovingSpherePlane(BoundingSphere s, Vector3 v, Plane p, ref float t, ref Vector3 q)
        {
            var num = Vector3.Dot(p.Normal, s.Center) - p.D;
            if (Math.Abs(num) <= s.Radius)
            {
                t = 0f;
                q = s.Center;
                return true;
            }
            var num2 = Vector3.Dot(p.Normal, v);
            if ((num2 * num) >= 0f)
            {
                return false;
            }
            var num3 = (num > 0f) ? s.Radius : -s.Radius;
            t = (num3 - num) / num2;
            if (t > 1f)
            {
                return false;
            }
            q = (s.Center + (t * v)) - ((num3 * p.Normal));
            return true;
        }