RealDocs

AActor::GetComponentsBoundingBox

function Engine Since 4.0
#include "GameFramework/Actor.h"
Access: public Specifiers: virtualconst

Description

Returns the world-space axis-aligned bounding box enclosing all registered components on this actor. Uses cached component bounds, making it fast for per-frame queries.

Caveats & Gotchas

  • The returned FBox may be invalid (IsValid() == false) if the actor has no registered primitive components — always check IsValid() before using the result for spatial logic.
  • Child actor components are not included unless bIncludeFromChildActors is true, which can cause surprising empty or undersized boxes on actors that delegate their mesh to a child actor.

Signature

ENGINE_API virtual FBox GetComponentsBoundingBox(bool bNonColliding = false, bool bIncludeFromChildActors = false) const;

Parameters

Name Type Description Default
bNonColliding bool If true, non-colliding components are included in the bounding box calculation. false
bIncludeFromChildActors bool If true, recursively includes components from actors attached via ChildActorComponents. false

Return Type

FBox

Example

Get bounding box to size an overlap sphere C++
FBox Box = MyActor->GetComponentsBoundingBox(/*bNonColliding=*/true);
if (Box.IsValid)
{
    FVector Origin, Extent;
    Box.GetCenterAndExtents(Origin, Extent);
    float Radius = Extent.Size();
    // Use Radius to set a detection sphere
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.