AActor::GatherCurrentMovement
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtual
Description
Fills the `ReplicatedMovement` struct with the actor's current location, rotation, velocity, and angular velocity so that data can be sent to clients. Called automatically by the replication system on the server each frame.
Caveats & Gotchas
- • When the root component has an AttachParent, ReplicatedMovement is populated with the relative transform rather than the world transform — clients must account for this when reading replicated movement data.
- • Overriding this function without calling Super::GatherCurrentMovement() will cause the ReplicatedMovement struct to remain stale, breaking movement replication for the actor.
- • This function runs only on the server; client-side movement prediction systems must not call it directly or assume it produces authoritative data on the owning client.
Signature
ENGINE_API virtual void GatherCurrentMovement(); Return Type
void Example
Override to add custom movement data C++
void AMyActor::GatherCurrentMovement()
{
Super::GatherCurrentMovement();
// Store additional server-side physics state alongside the standard movement struct
ReplicatedCustomSpeed = GetVelocity().Size();
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?