# Character swimming

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

Swimming on the water surface works similar to buoyancy except there's only one point that reads the wave data (typically located at the character's chest). Explore `BP_DemoCharacter` for better understanding how swimming works.

Core functionality is defined in the `BP_WaterSurfaceSwimming` component that is attached to the character.

{% hint style="warning" %}
Diving under the water currently is not implemented. It introduces a set of challenges related to animation and character rotation, so it was left for future updates. You can see the initial attempt of making it dive in the even graph in the `Movement Input` section.
{% endhint %}

The demo character switches from swimming to walking states by checking the overlapping actors around the feet area and for that to work they have `Generate Overlap Events` set to true.

Post process control rig is skipped in the character animation graph when the character swims, since it snaps the feet to the ground whenever there's something close to the feet.

Character gravity direction is updated accordingly. You might experience character rotation issues when away from the North Pole of the ocean sphere.

Swimming is experimental and is subject to change, but in its current state gives you a good starting point.

{% hint style="warning" %}
Currently swimming does not take into account waves attenuation feature since distance field is only accessible on GPU. That means a character will swim near the shoreline assuming waves have full strength there, although they are faded out using distance field. This might be fixed in the future by introdusing a distance field approximation on CPU using line or sphere traces.
{% endhint %}


---

# 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://docs.planetaryoceans.com/guide-v.-2.1/character-swimming.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.
