AActor::GetReplicatedMovement
#include "GameFramework/Actor.h"
Access: public
Specifiers: const
Description
Returns a const reference to the actor's replicated movement struct, which holds the location, rotation, linear velocity, and angular velocity as received from the server.
Caveats & Gotchas
- • On the server this reflects the authoritative state that will be sent to clients on the next update; on clients it reflects the last received network snapshot, which may lag behind the actor's actual interpolated transform.
- • Do not store the returned reference — it points directly into the actor's private member and will become stale if the actor is destroyed or the struct is reassigned via SetReplicatedMovement.
- • Velocity fields inside FRepMovement are only populated when bReplicateMovement is true and the actor is using the engine's built-in movement replication path.
Signature
const FRepMovement& GetReplicatedMovement() const Return Type
const FRepMovement& Example
Read replicated velocity on a client for visual effect C++
void AMyActor::OnRep_ReplicatedMovement()
{
const FRepMovement& RepMove = GetReplicatedMovement();
float Speed = RepMove.LinearVelocity.Size();
if (Speed > 500.f)
{
PlaySpeedEffect();
}
} See Also
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?