ACharacter::OnMovementModeChanged
#include "GameFramework/Character.h"
Access: public
Specifiers: virtualENGINE_API
Description
Called by CharacterMovementComponent whenever the movement mode changes (e.g. Walking → Falling, Falling → Walking). Resets JumpCurrentCount on landing and broadcasts MovementModeChangedDelegate.
Caveats & Gotchas
- • JumpCurrentCount is reset inside the base implementation when transitioning to Walking or Swimming. If you override this without calling Super::OnMovementModeChanged(), multi-jump tracking will break.
- • Both PrevMovementMode and the current mode (GetCharacterMovement()->MovementMode) are needed to understand the full transition. The new mode is not passed as a parameter — retrieve it from the component.
Signature
ENGINE_API virtual void OnMovementModeChanged(EMovementMode PrevMovementMode, uint8 PreviousCustomMode = 0); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| PrevMovementMode | EMovementMode | The movement mode that was active before the change. | — |
| PreviousCustomMode | uint8 | The previous custom mode index, only relevant if PrevMovementMode was Custom. | 0 |
Return Type
void Example
Play a landing sound when transitioning from Falling to Walking C++
void AMyCharacter::OnMovementModeChanged(EMovementMode PrevMovementMode, uint8 PreviousCustomMode)
{
Super::OnMovementModeChanged(PrevMovementMode, PreviousCustomMode);
EMovementMode NewMode = GetCharacterMovement()->MovementMode;
if (PrevMovementMode == MOVE_Falling && NewMode == MOVE_Walking)
{
UGameplayStatics::PlaySoundAtLocation(this, LandingSound, GetActorLocation());
}
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?