intersectsSphere method

bool intersectsSphere(
  1. BoundingSphere sphere
)

sphere - BoundingSphere to check for intersection against.

Determines whether or not this box intersects sphere.

Implementation

bool intersectsSphere(BoundingSphere sphere) {
  // Find the point on the AABB closest to the sphere center.
  clampPoint(sphere.center, _vectorBox3);

  // If that point is inside the sphere, the AABB and sphere intersect.
  return _vectorBox3.distanceToSquared(sphere.center) <= (sphere.radius * sphere.radius);
}