UCharacterMovementComponent::IsSwimming
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtualconstoverride
Description
Returns true when the current MovementMode is MOVE_Swimming and the component has a valid UpdatedComponent.
Caveats & Gotchas
- • Requires UpdatedComponent to be set — a movement component that hasn't been assigned one (e.g. before BeginPlay) reports false even if MovementMode was manually set to MOVE_Swimming.
- • MOVE_Swimming is entered automatically by PhysSwimming when the character's collision volume overlaps a PhysicsVolume with bWaterVolume set, not by calling this getter.
Signature
virtual bool IsSwimming() const override Return Type
bool Example
Checking swim state C++
if (GetCharacterMovement()->IsSwimming())
{
PlaySwimAnimation();
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?