ACharacter::OnCharacterMovementUpdated
#include "GameFramework/Character.h"
Access: public
Specifiers: UPROPERTYBlueprintAssignable
Description
Delegate broadcast at the end of each CharacterMovementComponent movement update, providing DeltaSeconds, the initial location, and initial velocity for that tick. Preferred over Tick for reacting to movement state changes because it fires during network correction replays as well.
Caveats & Gotchas
- • This fires multiple times per rendered frame during network move replays on the client. Any logic bound here must be idempotent or carefully guard against being called more than once per visual frame.
- • The InitialLocation and InitialVelocity parameters reflect values at the start of the movement update, not after it. Use GetActorLocation() and GetVelocity() inside the handler to get the post-update values.
Signature
FCharacterMovementUpdatedSignature OnCharacterMovementUpdated; Example
Compute speed for a HUD speedometer each movement update C++
void AMyCharacter::BeginPlay()
{
Super::BeginPlay();
OnCharacterMovementUpdated.AddDynamic(this, &AMyCharacter::HandleMovementUpdated);
}
void AMyCharacter::HandleMovementUpdated(float DeltaSeconds, FVector OldLocation, FVector OldVelocity)
{
CurrentSpeed = GetVelocity().Size();
} Version History
Introduced in: 4.8
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?