AActor::GetComponentsBoundingCylinder
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtualconst
Description
Computes the axis-aligned bounding cylinder that encloses all registered colliding components (or all components when bNonColliding is true). Both output values are set to 0 if the actor has no registered components.
Caveats & Gotchas
- • By default only collision-enabled components are included. Pass bNonColliding=true to get a cylinder that wraps every component regardless of collision settings.
- • For Pawns and Characters, GetSimpleCollisionCylinder() is preferred — it first checks whether the root component's collision is registered and falls back to this function only if it isn't, avoiding redundant iteration.
- • Child actor component traversal (bIncludeFromChildActors) adds cost proportional to the number of nested actors; avoid calling per-frame on actors with many ChildActorComponents.
Signature
virtual void GetComponentsBoundingCylinder(float& CollisionRadius, float& CollisionHalfHeight, bool bNonColliding = false, bool bIncludeFromChildActors = false) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| CollisionRadius | float& | Output: radius of the bounding cylinder. | — |
| CollisionHalfHeight | float& | Output: half-height of the bounding cylinder. | — |
| bNonColliding | bool | If true, include non-colliding components in the calculation. | false |
| bIncludeFromChildActors | bool | If true, recurse into ChildActor components to include their bounds. | false |
Return Type
void Example
Read the bounding cylinder of an actor C++
float Radius = 0.f, HalfHeight = 0.f;
MyActor->GetComponentsBoundingCylinder(Radius, HalfHeight);
UE_LOG(LogTemp, Log, TEXT("Radius=%.1f HalfHeight=%.1f"), Radius, HalfHeight); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?