intersectsSphere method

bool intersectsSphere(
  1. Sphere sphere
)

Implementation

bool intersectsSphere(Sphere sphere) {
  Vector3 temp = Vector3.zero();
  // Find the point on the AABB closest to the sphere center.
  clampPoint(sphere.position, temp);
  // If that point is inside the sphere, the AABB and sphere intersect.
  return temp.distanceToSquared(sphere.position) <=
      (sphere.radius * sphere.radius);
}