Skip to content

MotionWalkComponent

Manages base walking mechanics, movement direction analysis, and walking state to provide foundation for character locomotion. This component serves as the foundation for all movement components, providing core movement analysis and speed control.

Requirements

  • Character with UCharacterMovementComponent (by default it should have one)
  • MotionPlayerState configured in GameMode
  • Gameplay Ability System (GAS) initialized
  • Gameplay Effects:
    • GE_Motion_WalkSpeed - Modifies walk speed attribute
    • GE_Motion_Walking - Grants walking state tag
  • Gameplay Tags:
    • Motion.State.Walking - Active when character is walking
    • Attribute.Movement.WalkSpeed - Movement speed attribute tag

Installation

  1. Add UMotionWalkComponent to your Character Blueprint or C++ class
  2. Configure the component properties in the Details panel
  3. Set the WalkingTagEffect to GE_Motion_Walking
  4. Set the WalkSpeedEffect to GE_Motion_WalkSpeed
  5. Configure BaseWalkSpeed to match your AttributeSet default (typically 600)
  6. Enable bApplyCameraEffects if you want subtle camera movement during walking

Functionality

Main Update Flow

Expandability

The MotionWalkComponent provides numerous virtual functions for customization:

Core Walking Functions

FunctionParametersReturnsUse Case Examples
IsCurrentlyWalking()Nonebool• Add terrain restrictions
• Check stamina requirements
GetDirectionalSpeedMultiplier()Nonefloat• Combat stance modifiers
• Encumbrance system
UpdateWalkingState()float DeltaTimevoid• Custom state transitions
• Add walking conditions

Movement Analysis Functions

FunctionParametersReturnsUse Case Examples
CalculateMovementDirection()NoneFMotionMovementDirection• 8-way movement
• Analog stick deadzone
UpdateMovementDirection()float DeltaTimevoid• Smooth direction changes
• Add turn lag
UpdateMovementSpeed()float DeltaTimevoid• Acceleration curves
• Speed ramping
HasMovementDirectionChanged()NewDir, OldDirbool• Adjust sensitivity
• Filter small changes

Speed Modification Functions

FunctionParametersReturnsUse Case Examples
ApplyDirectionalSpeedMultipliers()float DeltaTimevoid• Surface-based speed
• Weather effects
ApplyWalkSpeedModification()Nonevoid• Buff/debuff system
• Equipment bonuses
RemoveWalkSpeedModification()Nonevoid• Clear status effects
• Reset to base speed

Camera Effect Functions

FunctionParametersReturnsUse Case Examples
StartWalkCameraEffects()Nonevoid• Custom camera shake
• View bobbing intensity
StopWalkCameraEffects()Nonevoid• Smooth camera reset
• Transition effects
GenerateCurveIdentifier()NoneFString• Unique effect IDs
• Multi-component support

Utility Functions

FunctionParametersReturnsUse Case Examples
InitializeComponent()Nonevoid• Custom initialization
• Additional caching
PrintDebugInformation()Nonevoid• Custom debug display
• Performance metrics

Blueprint Events

EventParametersUse Case Examples
OnWalkingStateChangedbool bIsWalking• Footstep sounds
• Animation triggers
OnMovementDirectionChangedFMotionMovementDirection NewDirection• Turn animations
• Lean adjustments
OnMovementSpeedChangedfloat NewSpeed, float SpeedPercentage• UI speed indicator
• Sound pitch variation

Configuration

Walking Settings (FMotionWalkSettings)

PropertyTypeDefaultDescriptionRange
MinWalkVelocityfloat50.0Minimum velocity to be considered "walking"1.0 - 200.0
ForwardSpeedMultiplierfloat1.0Walking speed multiplier for forward movement0.1 - 2.0
BackwardSpeedMultiplierfloat0.7Walking speed multiplier for backward movement0.1 - 2.0
StrafeSpeedMultiplierfloat0.8Walking speed multiplier for strafing movement0.1 - 2.0
bEnableDirectionalSpeedMultipliersbooltrueWhether to apply directional speed multipliers-

Core Configuration

PropertyTypeDefaultDescriptionRange
BaseWalkSpeedfloat600.0Base walk speed used for all multiplier calculations100.0 - 2000.0
bApplyCameraEffectsbooltrueWhether to apply camera effects during walking-
WalkCameraEffectFStructMotionCurve-Camera curve to apply during walking (subtle camera movement)-
bWalkingEnabledbooltrueWhether walking is currently enabled-

GAS Integration

PropertyTypeDescription
WalkSpeedEffectTSubclassOf<UGameplayEffect>Gameplay effect to apply for walk speed modification
MovementSpeedAttributeTagFGameplayTagGameplay tag for the movement speed attribute
WalkingTagEffectTSubclassOf<UGameplayEffect>Gameplay effect that grants the Motion.State.Walking tag

Debug

PropertyTypeDefaultDescription
bShowDebugInformationboolfalseDebug information display

State Tracking (Read-Only)

PropertyTypeDescription
CurrentMovementDirectionFMotionMovementDirectionCurrent movement direction data
WalkCameraEffectIdentifierFStringUnique identifier for walk camera effect
bIsLocallyPredictingboolWhether component is in local prediction state
LocalPredictedSpeedfloatLocally predicted speed value
LastLocalPredictionTimedoubleTimestamp of last prediction change

Local Prediction

The component supports client-side prediction for responsive multiplayer gameplay:

Prediction State Management

Prediction API

  • IsLocallyPredicting() - Check if in local prediction state
  • GetLocalPredictedSpeed() - Get predicted speed value
  • GetLastLocalPredictionTime() - Get timestamp of last prediction

Networking

The MotionWalkComponent handles networking through:

  • Client-side prediction for immediate response
  • Server validation for authoritative state
  • GAS replication for synchronized effects
  • Local-only camera effects for responsiveness without network overhead

Motion - Advanced First Person Character Controller