# OBB::Intersects (Sphere) ```cpp bool Intersects(const Sphere& sphere) const; ``` 检测该 OBB 与球体是否相交。将球心变换到 OBB 的局部坐标系,然后在局部空间中计算球心到盒子的最近点,最后判断距离是否小于球体半径。 **参数:** - `sphere` - 待检测的球体 **返回:** OBB 与球体相交返回 `true`,否则返回 `false` **异常:** 无 **线程安全:** ✅ **复杂度:** O(1) **示例:** ```cpp #include "AABB.h" #include "Vector3.h" #include "Sphere.h" using namespace XCEngine::Math; OBB obb(Vector3(0.0f, 0.0f, 0.0f), Vector3(1.0f, 0.5f, 1.0f)); Sphere sphere(Vector3(0.5f, 0.0f, 0.0f), 0.5f); if (obb.Intersects(sphere)) { } ```