# Step Modifier

{% embed url="<https://drive.google.com/file/d/1D6u1CEKc6WwVZxQAqTQX3ALm9MeT2vP3/view?usp=sharing>" %}

## Overview

**Step Modifier** creates procedural steps to avoid feet sliding when changing animation states (e.g., standing to crouching).

<figure><img src="/files/KgsvoaI0De17YwBKie4E" alt="" width="440"><figcaption></figcaption></figure>

#### Bone References

> Here you will find bone references to assign.

* **Pelvis** is the character pelvis or hip bone.
* **Right** and **Left Foot IK Target**: is the IK bone for the right or left foot. It's usually set to IK foot\_r or IK foot\_l.

#### Ground Alignment

> Here you will find settings for snapping feet to the ground.

* **Right Foot** is the character right foot bone (not an IK).
* **Left Foot** is the character left foot bone (not an IK).
* **Leg Stretch Factor** fine-tunes how aggressively the system detects and corrects leg stretching. Higher values increase the likelihood that a leg will be classified as “stretched” and have its length adjusted accordingly.

#### Step Motion

> Here you will find animation curves for feet and pelvis.

* **Lead Foot Motion** is the position animation for the leading foot (the one making a step first).
* **Follow Foot Motion** is the position animation for the following foot (the one making a step after the leading one).
* **Pelvis Motion** is the position animation for pelvis.

{% hint style="info" %}
**Note**: The Animation Curve values must at end zero for all motions.
{% endhint %}

* **Lead**, **Follow Foot** and **Pelvis Scale** are values that will scale each motion per-axis. For example, the X component will scale the X axis.
* **Play Rate** is the speed multiplier for this step motion.

#### Stride Settings

> Here you will properties that define the procedural step.

* **Animated Lead Foot** defines the leading foot for this step. A leading foot is the one making a step first.
* **Force Lead Foot** controls if the step must always start with a leading foot. If disabled, the leading foot will be determined based on the velocity vector.
* **Max Allowed Strength** defines the max allowed step length. If exceeded, feet will be moved in the movement direction to avoid stretching.
* **Max Allowed Offset Angle** defines the max allowed character rotation to avoid leg twisting. If exceeded, feet will be rotated around pelvis to compensate the rotation.
* **Step Cooldown Rate** is the time in seconds needed to pass before making the next step.

## Use-cases

**Step Modifier** can be used for any situation to replace feet sliding with a nice procedural step. Here are most popular applications:

1. Movement stop or start transitions.
2. New stance transition (e.g., going from rifle to sword, or from standing to crouching).
3. Turning in place.

{% hint style="success" %}
**Tip**: CAS comes with example Step presets, these can be found in KINEMATION/CharacterAnimationSystem/Examples/Steps/.
{% endhint %}

### Recommended settings

To get best results, make sure that:

1. **MaxAllowedStride** is set to \~0.3-0.4 to avoid character legs being strecthed. Setting this to a too small number will result in abrupt, unnatural steps.
2. **MaxAllowedOffsetAngle** is set to \~45 degrees to avoid legs being twisted.
3. **StepCooldownRate** is set to \~0.3-0.4s to handle player input-spamming situations.
4. **Force Lead Foot** can be used for specific cases, like turning in place — we only want to turn right with the right foot, and vice versa.
5. All animation curves start at zero for a seamless transition.

These settings might differ from one character model to another, so it's fine to experiment and find what works best for your character.

### How to play steps

Steps can be played at runtime using by updating the animation modifier:

{% code title="YourComponent.cs" overflow="wrap" %}

```csharp
private ProceduralAnimationComponent _proceduralAnimation;
private StepModifierSettings _yourStepModifier;

private void YourMethod()
{
    _proceduralAnimation.UpdateAnimationModifier(_yourStepModifier);
}
```

{% endcode %}

It's possible to play steps when a transition is entering or exiting a state in the Animator:

<figure><img src="/files/B7L9AoQeICP3x1Z01lTz" alt=""><figcaption><p>Syncing steps with animation states.</p></figcaption></figure>

This feature is used in the CAS Demo to play steps when turning in place or finishing climbing.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kinemation.gitbook.io/character-animation-system-docs/character-animation-system/animation-modifiers/step-modifier.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
