Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/Math > API/Runtime/Core/Math/FMath > API/Runtime/Core/Math/FMath/SphereAABBIntersection
References
Module | Core |
Header | /Engine/Source/Runtime/Core/Public/Math/UnrealMathUtility.h |
Include | #include "Math/UnrealMathUtility.h" |
Source | /Engine/Source/Runtime/Core/Public/Math/Box.h |
template<typename FReal>
static bool SphereAABBIntersection
&40;
const UE::Math::TVector< FReal > & SphereCenter,
const FReal RadiusSquared,
const UE::Math::TBox< FReal > & AABB
&41;
Remarks
Performs a sphere vs box intersection test using Arvo's algorithm:
for each i in (x, y, z) if (SphereCenter(i) < BoxMin(i)) d2 += (SphereCenter(i) - BoxMin(i)) ^ 2 else if (SphereCenter(i) > BoxMax(i)) d2 += (SphereCenter(i) - BoxMax(i)) ^ 2 Whether the sphere/box intersect or not.
Parameters
Name | Description |
---|---|
SphereCenter | the center of the sphere being tested against the AABB |
RadiusSquared | the size of the sphere being tested |
AABB | the box being tested against |