ACharacter::GetCapsuleComponent
#include "GameFramework/Character.h"
Access: public
Specifiers: inline
Description
Returns the CapsuleComponent used for movement collision. This is the primary collision shape that CharacterMovementComponent uses for physics queries and sweeps.
Caveats & Gotchas
- • The capsule is always treated as vertically aligned in simple collision checks — rotating the character does not tilt the capsule.
- • Resizing the capsule at runtime (e.g. during crouch) triggers a re-overlap check; avoid doing this every frame without caching the result.
Signature
inline class UCapsuleComponent* GetCapsuleComponent() const { return CapsuleComponent; } Return Type
UCapsuleComponent* Example
Resize capsule for crouch logic C++
UCapsuleComponent* Capsule = GetCapsuleComponent();
if (Capsule)
{
Capsule->SetCapsuleHalfHeight(44.f);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?