FMath::SphereAABBIntersection

Performs a sphere vs box intersection test using Arvo's algorithm:

Windows
MacOS
Linux

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

Syntax

static bool SphereAABBIntersection
(
    const FVector & SphereCenter,
    const float RadiusSquared,
    const FBox & AABB
)

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

Returns

Whether the sphere/box intersect or not.

Parameters

Parameter

Description

Sphere

the center of the sphere being tested against the AABB

RadiusSquared

the size of the sphere being tested

AABB

the box being tested against

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss