# Three.js Character Motion

> Create a jointed explorer with camera-relative movement, a terrain-following gait and collision sliding.

- Type: Lab Skill (downloadable Agent Skill)
- Category: [Game creation](https://www.sandbase.ai/skills/games)
- Version: 0.1.0
- Page: https://www.sandbase.ai/skills/games/threejs-character-motion

## What you get

A standalone explorer scene with rolling terrain and two stone obstacles. Procedural walking and running, terrain-following feet and collision sliding. Camera-relative input, orbit controls and movement regression tests.

## Install

Download the Skill package from https://www.sandbase.ai/skills/games/threejs-character-motion (sign-in required), unzip it into your agent's skills folder, then ask your agent to use it:

```text
/threejs-character-motion create a small explorer who runs over rolling terrain and walks around stone obstacles
```

## How it works

1. **Create the walking example** Three.js Character Motion creates its runnable project with node scripts/new-project.mjs --out ./my-character-motion, which requires a new directory. Then run npm ci, npm test, npm run dev and npm run build. A clothed explorer crosses a rolling meadow past two stones: WASD runs, Shift walks and dragging changes the view. Node.js 22.12+ and a GPU-capable browser are required.
2. **Adapt terrain, scale and garments** Change terrain, obstacles and camera framing in sources/demo.js, and character scale and walk or run speeds in explorer.js. The cap, backpack and garments each have their own module. The ground sampler returns world-space surface height, and feet and pelvis adjustments follow the character scale convention. references/integration.md documents the API contracts.
3. **Feed real movement and verify** Pass the actual post-collision displacement to explorer.update; passing intended velocity makes the feet slide. That is why a blocked explorer settles instead of running in place. After changes, run the affected tests, then check the browser entry, movement and the requested viewport. A build proves bundling only, while browser inspection proves the visual gait.

## FAQ

### What does Three.js Character Motion animate?

Three.js Character Motion animates a procedural stylized explorer with a jointed gait, terrain-following feet, camera-relative movement and collision sliding. It covers ground locomotion only. Swimming and climbing need separate animation and control work, and the character is a procedural mesh with joint and garment animation.

### Does Three.js Character Motion use any paid service?

No. Three.js Character Motion runs entirely in the browser from local source, with no model calls or API keys, so nothing is billed. Its pinned npm dependencies download during npm ci. The example's language selector switches the interface between Chinese and English.

### Why do feet slide in Three.js Character Motion?

Feet slide in Three.js Character Motion when explorer.update receives the intended velocity instead of the movement left after collision. Pass the real displacement and the gait matches the ground. A blocked character then settles in place instead of running against the obstacle.

### Can I drop Three.js Character Motion into my own game?

Yes. Three.js Character Motion is self-contained: the full example is in assets/project, with source under sources/archipelago and a small standalone integration in sources/demo.js. Copy or edit those modules inside your project, and keep assets/project/LICENSE and references/source-manifest.json with them.

### What licence covers Three.js Character Motion?

Three.js Character Motion includes MIT-licensed code. The MIT licence and a source manifest ship with the package, so keep both when you ship a project built on it.

### Does the Three.js Character Motion preview save my place?

The Three.js Character Motion preview remembers where you are only for the current session; reloading the embedded page resets it. Once downloaded, the project uses local browser storage.

## Examples

- Three.js Character Motion (html)
- Character motion (video)
