ACharacter::SaveRelativeBasedMovement
#include "GameFramework/Character.h"
Access: public
Description
Stores a new relative location and rotation in the BasedMovement struct so the character can correctly follow a dynamic movement base between frames.
Caveats & Gotchas
- • Called internally by CharacterMovementComponent every movement tick when the character is based on a dynamic object — do not call manually unless you are implementing a custom movement component.
- • The bRelativeRotation flag must be set consistently with how the base's rotation affects the character; mixing relative and absolute across frames will produce jitter when the base rotates.
- • Writes to the protected BasedMovement member, not the replicated ReplicatedBasedMovement — replication happens separately via GatherCurrentMovement.
Signature
ENGINE_API void SaveRelativeBasedMovement(const FVector& NewRelativeLocation, const FRotator& NewRotation, bool bRelativeRotation) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NewRelativeLocation | const FVector& | New relative location to store in BasedMovement. | — |
| NewRotation | const FRotator& | New rotation, either relative or absolute depending on bRelativeRotation. | — |
| bRelativeRotation | bool | If true, NewRotation is relative to the movement base; if false it is world-space. | — |
Return Type
void Example
Usage inside a custom movement component tick C++
// Inside a UCharacterMovementComponent subclass
FVector RelativeLocation = WorldLocation - BaseWorldLocation;
FRotator WorldRotation = UpdatedComponent->GetComponentRotation();
CharacterOwner->SaveRelativeBasedMovement(RelativeLocation, WorldRotation, false); Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?