public bool Intersects(Sphere sphere) { // Find the point on this AABB closest to the sphere center. // Vector3 pt = clostPtToAABB(this, sphere.pos); Vector3 pt = ClosestPoint(sphere.pos); // If that point is inside sphere, the AABB and sphere intersect. //if (closestPointOnAABB) // *closestPointOnAABB = pt; var s = MathFunc.DistanceSq(pt, sphere.pos); return(s <= sphere.r * sphere.r); }