ACharacter::GetBasedMovement
#include "GameFramework/Character.h"
Access: public
Specifiers: inlineconst
Description
Returns a read-only reference to the current `FBasedMovementInfo`, which describes the object the character is standing on, the bone they are attached to, and relative location/rotation.
Caveats & Gotchas
- • This returns a reference to the local `BasedMovement` struct, not the replicated `ReplicatedBasedMovement`. On simulated proxies, use `GetReplicatedBasedMovement()` if you need the server-authoritative base.
- • The `MovementBase` pointer inside `FBasedMovementInfo` can be null when the character is airborne or not standing on a dynamic object. Always null-check `GetBasedMovement().MovementBase` before dereferencing.
- • Modifying the returned reference is not supported — the struct is protected on write. Use `SetBase()` to change the movement base.
Signature
inline const FBasedMovementInfo& GetBasedMovement() const { return BasedMovement; } Return Type
const FBasedMovementInfo& Example
Check if the character is standing on a specific actor C++
bool AMyCharacter::IsStandingOnActor(AActor* TargetActor) const
{
const FBasedMovementInfo& Based = GetBasedMovement();
if (Based.MovementBase == nullptr)
{
return false;
}
return Based.MovementBase->GetOwner() == TargetActor;
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?