Slide Mover

Slope-sliding locomotion — automatically activated when slope exceeds maxWalkAngle, drives the unit down the slope via spring-damped physics with optional input resistance and automatic recovery.

GS_3DSlideMoverComponent handles slope-sliding locomotion. It activates automatically when the grounder detects a slope angle exceeding maxWalkAngle, and deactivates when the slope eases or the unit slows enough to recover.

Mode names: "Slide" (both movement and rotation)

For usage guides and setup examples, see The Basics: GS_Unit.

Mover component in the O3DE Inspector

 

Contents


How It Works

HandleMovement()

Called each post-physics tick while movement mode is "Slide":

  1. Reads slopeDir from MoverContextRequestBus::GetSlopeDirection.
  2. Computes destinationVelocity = slopeDir * baseSlideSpeed.
  3. If EnableInputSlideResistance is true, reads groundedMoveInput and applies an opposing influence:
    destinationVelocity += groundedMoveInput * InputResistanceInfluence
    
    This allows the player to push slightly against or across the slide direction.
  4. Fetches rigidBody->GetLinearVelocity() as the current velocity.
  5. Calls GS_Core::Springs::AccelerationSpringDamper(position, velocity, cachedAcceleration, destinationVelocity, moveHalflife, delta).
  6. Applies the result: rigidBody->SetLinearVelocity(velocity).
  7. Calls FinishSliding() to check whether the slide should end.

HandleRotation()

  1. Reads slopeDir from the MoverContext.
  2. Computes target yaw from slope direction using atan2f — unit faces down the slope.
  3. Calls GS_Core::Springs::QuaternionSpringDamper(currentRotation, cachedAngularVelocity, targetRotation, rotateHalflife, delta).
  4. Applies cachedAngularVelocity.Z to rigidBody->SetAngularVelocity().

Finish Sliding

FinishSliding() is called every movement tick. It returns true and triggers recovery when both conditions are met:

  • The current slope angle is below minSlideAngle
  • The unit’s current speed is below minSpeedToStop

On recovery:

MoverContextRequestBus::ChangeMovementMode(recoveryMoveMode);
MoverContextRequestBus::ChangeRotationMode(recoveryRotateMode);

Both modes default to "Free", returning the unit to standard locomotion.


Editor-Exposed Settings

FieldDefaultDescription
moveHalflife0.1Spring halflife for slide velocity.
rotateHalflife0.15Spring halflife for rotation toward slope direction.
baseSlideSpeed8.0Target speed along the slope direction (m/s).
EnableInputSlideResistancetrueWhether player input can partially resist or redirect the slide.
InputResistanceInfluence2.0Scalar applied to groundedMoveInput when computing resistance. Higher = more player control.
minSlideAngle20°Slope angle below which the unit may recover (if also slow enough).
minSpeedToStop1.5Speed threshold below which the unit may recover (if also on shallow slope).
recoveryMoveMode"Free"Movement mode to switch to on recovery.
recoveryRotateMode"Free"Rotation mode to switch to on recovery.

Extension Guide

Extend GS_3DSlideMoverComponent to override slide behavior while keeping the base spring physics and recovery logic.

#pragma once
#include <Source/Unit/Mover/GS_3DSlideMoverComponent.h>

namespace MyProject
{
    class MySlide : public GS_Unit::GS_3DSlideMoverComponent
    {
    public:
        AZ_COMPONENT_DECL(MySlide);
        static void Reflect(AZ::ReflectContext* context);

    protected:
        void HandleMovement() override;
    };
}
void MySlide::HandleMovement()
{
    // Call base for standard slope physics
    GS_3DSlideMoverComponent::HandleMovement();

    // Add custom post-processing (e.g. audio trigger, particle effect on slide)
}

See Also

  • Movers — Mover base class and class hierarchy
  • GS_3DFreeMoverComponent — Standard free-locomotion mover
  • Mover Context — Provides slopeDir, groundedMoveInput, and mode switching
  • Grounders — Detect slope angle and trigger the switch to Slide mode
  • Springs UtilityAccelerationSpringDamper and QuaternionSpringDamper used internally

Get GS_Unit

GS_Unit — Explore this gem on the product page and add it to your project.