public bool Overlaps(Sphere other) { Vector3 diff = other.center - center; float f = radius + other.radius; return(diff.MagnitudeSqr() <= (radius * radius)); }
public Vector3 ClosestPoint(Vector3 p) { Vector3 toPoint = p - center; if (toPoint.MagnitudeSqr() > radius * radius) { toPoint = toPoint.GetNormalized() * radius; } return(center + toPoint); }
public bool Overlaps(Vector3 p) { Vector3 toPoint = p - center; return(toPoint.MagnitudeSqr() <= (radius * radius)); }