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;
}