Appearance
MotionCrouchingComponent
MotionCrouchingComponent wraps Unreal's native crouch system with GAS integration, camera height coordination, speed effects, and uncrouch collision checks.
Requirements
- Character with standard
UCharacterMovementComponentandUCapsuleComponent - A resolvable
UAbilitySystemComponent, commonly exposed by a PlayerState that implementsIAbilitySystemInterface - Gameplay Ability System initialized
- Enhanced Input configured
- Crouch speed, wants-to-crouch, and crouching GameplayEffects
- GameplayTags for crouch intent and active crouch
For setup and input binding steps, see How to add Motion to a character.
Behavior
The component uses Unreal's built-in Character->Crouch() and Character->UnCrouch() behavior. CharacterMovementComponent owns capsule resizing and built-in prediction. Motion adds input handling, GAS state, speed effects, blocked-uncrouch event dispatch, clearance checks, and camera height updates.
When the locally controlled character crouches or stands, the component updates its MotionCameraComponent height when one is present. The camera component then interpolates its own height independently from the capsule.
API
Commands
SetWantsToCrouch(bool bWantsToCrouch) -> void: sets crouch intent.
GAS and input
HandleCrouchInputStateChange(bool bPressed) -> void: processes crouch input press/release with local prediction and server RPC.
Profile
GetProfile() -> UMotionCrouchProfile*: returns the assigned crouch profile.SetProfile(UMotionCrouchProfile* NewProfile) -> void: assigns a setup-time profile before BeginPlay.HasValidProfile() -> bool: checks whether the assigned profile validates.
Configuration
Configuration lives on the assigned MotionCrouchProfile. The current Motion default is /MotionCore/Motion/Profiles/v2_0_0/DA_MotionCrouchProfile_Default_v2_0_0.
Crouch settings
CapsuleHalfHeightWhenCrouching: target capsule half height while crouched. Default:48.0.CrouchWalkSpeedModifier: walk speed value added while crouching. Default:-200.0.bRequiresContinuousInput: whentrue, crouch is held input; whenfalse, each press toggles crouch intent. Default:true.
GAS effects
CrouchSpeedEffect: effect for crouch speed modification.WantsToCrouchTagEffect: grants wants-to-crouch tag.CrouchingTagEffect: grants crouching state tag.
Speed modification uses SetByCaller_Magnitude_CrouchSpeed internally.
The main setting you edit is the Profile reference. GameplayEffect class references stay on the profile; crouch input state, active effect handles, cached capsule values, and diagnostics stay on the component.
Runtime State
Most of these fields are protected component state; some are exposed read-only to derived Blueprints, while active effect handles remain C++ implementation details. bShowDebugInformation is public debug configuration.
ActiveCrouchSpeedEffectHandle: handle to active speed effect.WantsToCrouchTagHandle: handle to wants-to-crouch tag effect.CrouchingTagHandle: handle to crouching state tag effect.OriginalCapsuleHalfHeight: capsule half height cached at BeginPlay.CachedCapsuleComponent: inherited cached capsule reference.CachedCameraComponent: inherited cached Motion camera reference.bWasCrouchedLastFrame: previousbIsCrouchedstate.bWasBlockedLastFrame: tracks blocked uncrouch state so the event fires once.bShowDebugInformation: debug display flag.
Blueprint Events
OnCrouchBlockedDelegate(): fires when uncrouching is blocked.
State Access
- Crouch intent: check
Motion.State.WantsToCrouchon the actor's AbilitySystemComponent. - Active crouch: use native
ACharacter::IsCrouched()orMotion.State.Crouching. - Capsule height: read the owning character's
UCapsuleComponent.
Networking
The owning input path predicts a loose wants-to-crouch tag and sends ServerRequestCrouch; it also calls native ACharacter::Crouch() or UnCrouch(), whose movement state is handled by CharacterMovementComponent. Server-owned GAS speed and state effects replicate separately, while camera interpolation runs only for the locally controlled view.