# characterController
The character controller of the Controllers world. `CharacterController`
moves a character with capsule casts: walking, running and jumping, coyote time,
slopes, steps, moving platforms, carrying, pushing and swimming. `MovementState`
states the motion its animation reads, and `Locomotion` (or the 87-clip
`LocomotionFull`) plays the Synty Polygon Masculine clips this package holds
from it. `WASDInput` drives a controller from the keyboard, and the
`characterController` toolbox installs the set on an entity.
`CharacterController` carries the `bodyMover` and `playerDefault` tags and
`MovementState` carries `playerDefault`, so a default player authored once the
package is installed walks with them. The player's controls drive the
character once it is bound as the local player's body
(`layers.active.players.localPlayer.avatar = entity(id)`); any other
character moves on what writes its `CharacterController` input bus.
Installed as `@controllers` (`world.installLibrary({ world =
"034d26cf-dc3d-4123-abad-3944f97c6a60", as = "controllers" })`), its assets are
`characterController.<name>`.
## Layout
```
characterController.package/
CharacterController.component -- the mover
MovementState.component -- the motion the animation reads
Locomotion.component -- blend-space animation (synty preset)
LocomotionFull.component -- the 87-clip variant (synty_full preset)
WASDInput.component -- keyboard drive of a controller's input bus
AnimDebug.component -- an overlay of the controller's state
characterController.module/ -- install / uninstall / preset, and the
-- collision and movement helpers
presets/ -- feel presets and the Synty clip presets
files/synty/ -- the Synty body and its animation clips
inputMaps/flight.inputMap -- flyUp / flyDown for a flying player
tools/characterController.toolbox/ -- install and uninstall tools
documentation/ -- 01-overview to 05-launch-and-knockback
```
## Flow
```
┌────────────────────┐
user / agent ──┤ characterController│
│ .toolbox │
└────────────────────┘
│
▼
┌──────────────────────┐
custom code ──────┤ characterController │── install /
(require) │ .module (API) │ uninstall / preset
└──────────────────────┘
│
▼
┌────────────────────────┐
│ CharacterController │
│ + Locomotion │
│ + MovementState │
│ + AnimDebug │
│ (+ third-person cam) │
└────────────────────────┘
│
▼
WASD-driven character with animation
on any entity, no hand wiring required.
```
`characterController.install(entity, opts)` is the only thing most callers
need — it adds the controller, the locomotion graph, the movement-state
mirror, and (optionally) a third-person camera child. The package is
self-contained: it depends only on standard utility modules and on the
animation graph engine, never on game-specific code.
## The engine's locomotion contract
`Locomotion` and `LocomotionFull` carry the `locomotion` tag in their
`.metadata`, and the `synty`, `synty_full` and `humanoid` presets carry it as
clip sets for them. The engine reaches a body's locomotion through that tag
(`@builtin::modules.api.engine.body_locomotion`): an avatar's composition
states the way its body faces, a body swap rebuilds its graph, and the avatar's
animator, a headset body and a carried prop read its facing. The `synty`
preset also carries `playerDefault`: it is the clip set every humanoid avatar
in a world holding this package animates with when it names none.
## Documentation
- [`documentation/01-overview.md`](documentation/01-overview.md) — what
this package is and when to reach for it.
- [`documentation/02-install.md`](documentation/02-install.md) — the
`characterController.install(id, opts)` recipe.
- [`documentation/03-presets.md`](documentation/03-presets.md) —
shipped presets (synty, default humanoid) and authoring your own.
- [`documentation/04-customize.md`](documentation/04-customize.md) —
overriding components, swapping the camera, custom blend spaces.