> For the complete documentation index, see [llms.txt](https://docs.otherside.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.otherside.xyz/odk-docs/odk-plugin/movement-modes.md).

# Movement Modes

The ODK seperates different types of movements into different conceptual movement modes. Walking, grinding and gliding are examples of different movement modes available in the base ODK.

Movement modes are controlled via a component on the `BP_ODK_PlayerCharacterBase` render target. By default, this component is `BPC_ODK_MovementComponent`, however this can be overriden on `BP_ODK_PlayerCharacterBase` by setting the `MovementComponentClass` property.

The `BPC_ODK_MovementComponent` controls which movement mode should be active at a given time. A mapping is defined on this component between a "movement mode id" (an instance of DA\_ODK\_MovementModeId) and a movement mode component class. This allows for easy overriding and addition of movement mode behaivours.

<figure><img src="/files/uWnNF2u9kpsDYCOfjV4j" alt=""><figcaption></figcaption></figure>

A description of other useful properties:\
\- `Initial Movement Mode` - The movement mode your character will start in.\
\- `Default Movement Mode` - The movement mode that your character can default to after leaving a movement mode.\
\- `Startup Movement Modes` - Movement modes that will be initialized at the start of the game rather than created dynamically when first requested. This has very niche uses.

Each movement mode is wrapped up in it's own component that derives from `BPC_ODK_MovementModeComponentBase`.

`BPC_ODK_MovementModeComponentBase` components as a good general rule should manage these areas:

* Input - Handling enhanced input actions that modify the behaivour within a movement mode.
* Character movement - The logic that actually moves the character.
* Movement mode validity - Whether it is appropriate to be able to enter the movement mode. This is comunicated through the `CanEnterToMovementMode` function.
* Ending the movement mode - Ensuring the movement mode is ended when appropriate.

### GlidingMovementMode Example

We will now consider the `BPC_ODK_GrindingMovementMode` as an example.

Here we can see how input is processed in the grinding movement mode. The only valid input action on a grinding rail is "Jump". First, we override the `BPC_ODK_MovementModeComponentBase` base function `AddInputBindings`. Inside this function we can call `AddInputAction` for each input we want to process. We can bind to the `IA_ODK_Jump` input action listening to the "Triggered" event and setup our callback. Inside the callback we perform the appropriate logic. In this case stopping the grinding and making the character jump. You can see that the callback has a "Value" paramater that is sometimes useful when processing input. You should use the value corresponding to the "Value Type" on the given input action.

<figure><img src="/files/shbICQRwJqufm1wdkQ6R" alt=""><figcaption><p>Adding a binding for an input action</p></figcaption></figure>

<figure><img src="/files/vBmTYDvuApGQlvAY0zfg" alt=""><figcaption><p>Processing an input action to make the character jump. The "Value" param is not used but is show here for demonstration.</p></figcaption></figure>

Ending the movement mode can be done by simply requesting a new movement mode. Inside the `BPC_ODK_GrindingMovementMode` `StopGrinding` function, `TrySetDefaultMovementMode` is called on the ODK movement component. We could transition to any movement mode we liked at this point but recommend going back to a the default movement mode.

<figure><img src="/files/diyo9yzHWS6IrDvWbtI9" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://docs.otherside.xyz/odk-docs/odk-plugin/movement-modes.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.
