UCharacterMovementComponent::SetGroundMovementMode
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: ENGINE_API
Description
Sets which movement mode (MOVE_Walking or MOVE_NavWalking) the character should switch to when it stops falling and resumes ground movement. If the character is currently on the ground, this also changes the active movement mode immediately.
Caveats & Gotchas
- • Passing any value other than MOVE_Walking or MOVE_NavWalking is silently ignored — there's no error or warning if you pass, say, MOVE_Flying.
- • If the character is currently walking or nav-walking, calling this also switches the current mode via SetMovementMode() right away, not just the pending post-fall mode.
- • This is the supported way to toggle NavMesh-following ground movement on and off at runtime, rather than calling SetMovementMode(MOVE_NavWalking) directly.
Signature
void SetGroundMovementMode(EMovementMode NewGroundMovementMode) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NewGroundMovementMode | EMovementMode | The mode to switch to when the character returns to ground movement after falling. Only MOVE_Walking and MOVE_NavWalking are valid; other values are ignored. | — |
Return Type
void Example
Switching between walking and nav-walking C++
UCharacterMovementComponent* Movement = GetCharacterMovement();
if (bUseNavMeshWalking)
{
Movement->SetGroundMovementMode(MOVE_NavWalking);
}
else
{
Movement->SetGroundMovementMode(MOVE_Walking);
} See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?