APawn::GetMovementBase
#include "GameFramework/Pawn.h"
Access: public
Specifiers: virtual
Description
Returns the `UPrimitiveComponent` the pawn is standing on, attached to, or otherwise using as a movement base. The base `APawn` returns null; `ACharacter` overrides this to expose the character movement component's base.
Caveats & Gotchas
- • The base `APawn` implementation always returns `nullptr`. If you call this on a plain `APawn` subclass that doesn't override it you will always get null — only `ACharacter` (via its movement component) populates this.
- • Use `APawn::GetMovementBaseActor` (a static helper) to retrieve the owning actor of the base component rather than the component itself, which is more commonly what you need.
Signature
virtual UPrimitiveComponent* GetMovementBase() const Return Type
UPrimitiveComponent* Example
Detect when the character is standing on a moving platform C++
if (UPrimitiveComponent* Base = MyCharacter->GetMovementBase())
{
if (AActor* BaseActor = Base->GetOwner())
{
UE_LOG(LogTemp, Log, TEXT("Standing on: %s"), *BaseActor->GetName());
}
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?