# Animating Meshes

<figure><img src="https://1658932074-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MY8fZDrjtjkuDPIeyPu%2Fuploads%2F7lRyvsqDg1cEmentPNqS%2Fanimationgg.gif?alt=media&#x26;token=c90071a8-b356-4f04-a941-a94feb2491c9" alt=""><figcaption></figcaption></figure>

### Creating a new animation

Before we begin, we must pull up the timeline in the mesh maker. The timeline is a separate part of the animation system that allows us to modify the rotation and move positions of the mesh in real time, and gives us a visualiation of how the mesh will move in game when the animation is played.

<figure><img src="https://1658932074-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MY8fZDrjtjkuDPIeyPu%2Fuploads%2FN7JOqOKqsJzq1ijJ4pMv%2Fanimating.gif?alt=media&#x26;token=351c0028-2339-44da-a221-4090203a48ac" alt=""><figcaption><p>An example of how to pull up the animation system</p></figcaption></figure>

in the mesh make you should see a bar with timeline on it, hover the mouse over it and pull upwards like in the gif above. This will reveal the timeline.

{% hint style="info" %}
Its important to note that animations change the positions of the bones. So if you save a mesh file it will retain the last values of the animation as well.&#x20;
{% endhint %}

{% hint style="info" %}
It's a good idea to place the starting position of the animation in the first frame of the animation. That way the starting position will always be starting from that place.
{% endhint %}

### Adding Keyframes&#x20;

Animations in Unfolding work by having keyframes that tell the mesh to move or rotate the bone name of the mesh to a position at the keyframe it was created in. This means too that bone names across different meshes can still be affected by the animation as long as they share the same bone names.

<figure><img src="https://1658932074-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MY8fZDrjtjkuDPIeyPu%2Fuploads%2Fg8XFwroYU8v2bWqd5Qvc%2Fmovepart.gif?alt=media&#x26;token=3079c0fb-ae76-4934-926b-14d4cc0beb28" alt=""><figcaption><p>An example of creating an animation that moves the left portion of the mesh</p></figcaption></figure>

Going into the move tab, you can rotate and move parts of the bone. When you do this, the bone will save the modification be it a move or a rotate into a keyframe below. The frame the player is set as will determine where the keyframe goes.

You can add more frames by selecting the right of the purple bar and moving it to the right.

{% hint style="info" %}
The FPS for Unfolding is 60fps (frames per second). Meaning that each keyframe is 1/60th of a second.
{% endhint %}

### Saving and Loading

Animations are stored separately from the mesh they work on. In the timeline tab there is a save and load towards the right of the timeline. There is the load mesh and save mesh button which is the top right but that just controls the mesh. The animation load button opens up the animation database which allows for loading previously made mesh animations.


---

# 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://barchboi.gitbook.io/unfolding-engine-manual/mesh-skeletal-making/animating-meshes.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.
