# Give a 3D character a walk, run or idle animation

> Have an Agent give a 3D character a skeleton for its kind of body and moves such as walk and run, then see them in your game.

Source: https://air.build/docs/build/animate-a-3d-character/

To walk or run in a game, a 3D character needs a skeleton inside it and moves made for that skeleton. An Agent can add both: it checks that the character can take a skeleton, fits one made for its kind of body, and adds the moves you name, such as walk and run. You ask in the project's chat, then see the moves in your game.

To get the character in the first place, from a description, a drawing or a photo, see [Add 3D models to your app or game](https://air.build/docs/build/add-3d-models/#ask-for-a-model).

> [!NOTE]
> AirBuild has no screen for animating a model. You ask an Agent in the project's chat, and it uses `modelgen anim`, with its `check`, `rig` and `retarget` steps. See [modelgen](https://air.build/docs/cli/modelgen/#model-anim-mesh).

## Ask for the moves

1. Open the project's chat.
2. Say which character: one an Agent sent earlier in the chat, one already in the project, or a model file you attach with **+** (GLB, FBX, OBJ or STL). See [Send photos, files and sketches to an Agent](https://air.build/docs/projects/send-photos-and-files/).
3. Say what kind of body it has. See [Say what kind of body it has](https://air.build/docs/build/animate-a-3d-character/#say-what-kind-of-body-it-has).
4. Name the moves, up to five at a time.
5. If your game moves the character around by itself, ask for the moves in place. See [In place or moving](https://air.build/docs/build/animate-a-3d-character/#in-place-or-moving).
6. Optionally, say which file your game needs: GLB or FBX. If you don't know, leave it to the Agent.

For example:

```text
Animate the fox from this morning. It walks on four legs. Add idle, walk and run, in place, because the game moves it. Send it as GLB.
```

### Say what kind of body it has

The Agent fits a skeleton made for one kind of body. Saying which kind your character has helps it pick the right one.

| Body | For example | The Agent's `--rig-type` |
| --- | --- | --- |
| Two legs | A person, a robot, an animal standing upright | `biped` |
| Four legs | A dog, a horse, a fox | `quadruped` |
| Six legs | An insect | `hexapod` |
| Eight legs | A spider | `octopod` |
| A bird | A parrot, a chicken | `avian` |
| A long body without legs | A snake | `serpentine` |
| A body made for water | A fish | `aquatic` |

### Name the moves

The help for `modelgen anim retarget` gives walk and run as its examples, and takes up to five moves in one go. Ask for the moves your game uses, such as idle (standing still), walk and run. To know which other moves it can add, ask the Agent.

Each move counts toward your plan's AI usage, so ask for the ones the game plays. See [Understand your usage](https://air.build/docs/team/understand-usage/#what-counts-toward-your-plan).

### In place or moving

| Ask for | What you get |
| --- | --- |
| In place | The character moves its legs but stays on the spot, and your game moves it around. The help calls this "no root motion". |
| Nothing said | The move itself can carry the character forward. |

Not sure? Say how the game moves the character, for example "the player steers it with a joystick", and let the Agent choose.

## What the Agent does

1. It checks whether the character can take a skeleton. If it can't, it tells you. See [Questions](https://air.build/docs/build/animate-a-3d-character/#questions).
2. It fits the skeleton for the body you named.
3. It adds the moves you asked for, in place if you said so.
4. It sends the animated character in the chat as a GLB or FBX file.

## Look at the moves

The animated character arrives in the chat as a file. AirBuild has no 3D viewer of its own: tapping the file hands it to your device, as described in [Add 3D models to your app or game](https://air.build/docs/build/add-3d-models/#look-at-what-arrives). Whether you see the moves there depends on the app that opens the file.

To watch the moves, put the character in your game and play it in Preview.

## Put it in your game

Tell the Agent when each move plays:

```text
Use the animated fox as the player. Play idle when it stands still, walk when it moves, and run when it goes fast.
```

The Agent adds the character to the project and the game. Once the game is built again, open Preview and play it. See [Make a game](https://air.build/docs/build/make-a-game/#play-it-in-preview).

If a move looks wrong, say which move and what you saw. The earlier files stay in the chat.

To have parts of a model move on their own, such as a car's wheels, see [Split a 3D model into parts](https://air.build/docs/build/split-a-3d-model-into-parts/).

## Questions

**The Agent says the character can't be animated.**

Its check found that the model can't take a skeleton. Ask for a new character made to be animated: `modelgen make` has a preset for it (`--for anim`). Attach a picture of your character as the starting point.

**The character walks off its spot in the game.**

The moves carry it forward while the game moves it too. Ask for the moves again in place.

**Which file should I ask for?**

The moves come as GLB or FBX. If you don't know which one your game needs, leave it out and the Agent picks one.

**Can I animate a model I made somewhere else?**

Yes. Attach it with **+** as a GLB, FBX, OBJ or STL file, and say what kind of body it has.

**Does each move count toward my plan?**

Yes. Each move counts toward your plan's AI usage on its own, as does making the model. If your Agents use your own key or subscription, the moves still count. See [Understand your usage](https://air.build/docs/team/understand-usage/#what-counts-toward-your-plan).

**The Agent says it can't make models right now.**

Your plan's AI usage may be used up; if so, a card above the message box says so. See [Understand your usage](https://air.build/docs/team/understand-usage/#when-usage-runs-low).
