APawn::RecalculateBaseEyeHeight
#include "GameFramework/Pawn.h"
Access: public
Specifiers: virtual
Description
Updates `BaseEyeHeight` to reflect the pawn's current state. Called automatically after crouching/uncrouching in `ACharacter`; override to implement custom eye-height logic.
Caveats & Gotchas
- • The base `APawn` implementation is empty. `ACharacter` overrides this to lerp between `BaseEyeHeight` and `CrouchedEyeHeight` — always call `Super::RecalculateBaseEyeHeight()` if deriving from `ACharacter`.
- • `BaseEyeHeight` affects `GetActorEyesViewPoint` which is used for first-person camera placement, line-of-sight tests, and AI perception — incorrect values will cause subtle aiming/camera errors.
Signature
virtual void RecalculateBaseEyeHeight() Return Type
void Example
Adjust eye height for a prone state C++
void AMyCharacter::RecalculateBaseEyeHeight()
{
if (bIsProne)
{
BaseEyeHeight = ProneEyeHeight;
}
else
{
Super::RecalculateBaseEyeHeight();
}
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?