UCharacterMovementComponent::DisableMovement
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallablevirtual
Description
Makes movement impossible by setting the movement mode to MOVE_None.
Caveats & Gotchas
- • If CharacterOwner is null, it sets MovementMode/CustomMovementMode directly instead of going through SetMovementMode(), which skips the OnMovementModeChanged callback.
- • Does not zero out Velocity or clear queued forces — call ClearAccumulatedForces() separately if pending impulses or a launch should also be cancelled.
Signature
virtual void DisableMovement() Return Type
void Example
Freeze character on death C++
void AMyCharacter::OnDeath()
{
GetCharacterMovement()->DisableMovement();
GetCapsuleComponent()->SetCollisionEnabled(ECollisionEnabled::NoCollision);
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?