К основному содержанию
скилл CX Codex

add-3d-assets — скилл для Claude Code: GLB-модели в Three.js

Меняет примитивы вроде BoxGeometry на настоящие GLB-модели: персонажи с анимацией, дома, деревья, бочки. Пригодится, когда игра на Three.js выглядит как набор коробок.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add PlayableIntelligence/game-creator --skill add-3d-assets -a claude-code
Открыть на GitHub

Что делает add-3d-assets

Скилл анализирует проект, находит все места с BoxGeometry и SphereGeometry, а потом заменяет их моделями. Персонажей и врагов он генерирует через Meshy AI: текстовый промпт, риггинг, анимации Idle, Walk и Run. Окружение — дома, деревья, бочки, монеты — либо тоже генерируется, либо берётся из бесплатных библиотек вроде Poly Haven и Sketchfab.

Для работы с Meshy нужен ключ MESHY_API_KEY. Скилл сначала ищет его в .env, а если не находит — просит вставить ключ и сохраняет туда же. Можно ответить «skip» и обойтись библиотекой готовых моделей: там лежат Soldier, Xbot, RobotExpressive и Fox с набором анимаций.

Интеграция идёт по шагам: создаётся src/level/AssetLoader.js, в Constants.js добавляются CHARACTER, ASSET_PATHS и MODEL_CONFIG, в Player.js появляется AnimationMixer с кроссфейдом между действиями, а в Game.js — OrbitControls для камеры от третьего лица. Один момент легко упустить: для анимированных моделей нужен SkeletonUtils.clone() из three/addons/utils/SkeletonUtils.js. Обычный .clone() копирует меш без скелета, и персонаж застывает в T-позе. В конце скилл советует прогнать npm run dev и npm run build, а также собрать ATTRIBUTION.md из .meta.json файлов.

Какие задачи решает

  • заменить коробки-примитивы на настоящие GLB-модели
  • сгенерировать персонажа по текстовому описанию и зариггить его
  • настроить кроссфейд между Idle, Walk и Run
  • подключить камеру от третьего лица с OrbitControls
  • починить модель, застрявшую в T-позе

Примеры запросов агенту

  • /add-3d-assets examples/space-explorer
  • /add-3d-assets
  • замени примитивы на GLB-модели в этом проекте

Как установить add-3d-assets

1Через Skills CLI (Vercel)

npx skills add PlayableIntelligence/game-creator --skill add-3d-assets -a claude-code

2Вручную: положить файлы

~/.claude/skills/add-3d-assets/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/add-3d-assets/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о add-3d-assets

Как установить add-3d-assets в Claude?

Выполните npx skills add PlayableIntelligence/game-creator --skill add-3d-assets -a claude-code. После этого скилл появится в ~/.claude/skills/add-3d-assets/SKILL.md.

Что делает add-3d-assets?

Ищет в проекте примитивы Three.js и заменяет их на GLB-модели: анимированных персонажей через Meshy AI и объекты окружения из библиотек или той же генерации. Заодно настраивает загрузчик, анимации и камеру.

Что нужно для работы скилла?

Ключ MESHY_API_KEY для генерации моделей. Без него скилл переходит на бесплатную библиотеку персонажей и поиск готовых ассетов.

Исходный текст

SKILL.md · MIT
---
name: add-3d-assets
description: Replace primitive 3D shapes with real GLB models — animated characters, world props, buildings, and scenery for Three.js games. Use when the user says "add 3D models", "replace the boxes with real models", "add GLB assets", or "make the 3D game look real". For 2D pixel art, use add-assets instead. Do NOT use for 2D pixel art (use add-assets) or gameplay changes (use add-feature).
argument-hint: "[path-to-game]"
license: MIT
metadata:
  author: OpusGameLabs
  version: 1.3.0
  tags: [game, 3d, assets, glb, models, threejs]
---

## Performance Notes

- Take your time to do this thoroughly
- Quality is more important than speed
- Do not skip validation steps

# Add 3D Assets

Replace basic geometric shapes (BoxGeometry, SphereGeometry) with real 3D models. Characters get custom Meshy AI-generated models with rigging and animation. World objects get generated or sourced from free libraries.

## Instructions

Analyze the game at `$ARGUMENTS` (or the current directory if no path given).

First, load the game-3d-assets skill and the meshyai skill for the full model pipeline, AssetLoader pattern, Meshy generation, and integration patterns.

### Step 1: Get Meshy API Key

Check if `MESHY_API_KEY` is set. First check `.env`:
`test -f .env && grep -q '^MESHY_API_KEY=.' .env && echo "found"`
If found, export it with `set -a; . .env; set +a` and skip the prompt.

If not set, ask the user:

> I'll generate custom 3D models with Meshy AI for the best results. You can get a free API key in 30 seconds:
> 1. Sign up at https://app.meshy.ai
> 2. Go to Settings → API Keys
> 3. Create a new API key
>
> Paste your key below like: `MESHY_API_KEY=your-key-here`
> (It will be saved to .env and redacted from this conversation automatically.)
>
> Or type "skip" to use free model libraries instead.

### Step 2: Audit

- Read `package.json` to confirm this is a Three.js game (not Phaser — use `/add-assets` for 2D games)
- Read `src/core/Constants.js` for entity types, sizes, colors
- Read entity files (`src/gameplay/*.js`, `src/entities/*.js`) — find `BoxGeometry`, `SphereGeometry`, etc.
- Read `src/level/LevelBuilder.js` for environment primitives
- List every entity using geometric shapes
- Identify which entity is the **player character** (needs animated model)

### Step 3: Plan

Split entities into two categories:

**Animated characters** (player, enemies with AI) — generate with Meshy AI:

| Entity | Meshy Prompt | Notes |
|--------|-------------|-------|
| Player | "a heroic knight, low poly game character, full body, t-pose" | Generate → rig → animate |
| Enemy | "a goblin warrior with a club, low poly game character" | Generate → rig → animate |

If Meshy unavailable, fall back to `assets/3d-characters/`:
- **Soldier** — realistic military (Idle, Walk, Run) — best default
- **Xbot** — stylized mannequin (idle, walk, run + additive poses)
- **RobotExpressive** — cartoon robot (Idle, Walking, Running, Dance, Jump + 8 more)
- **Fox** — low-poly animal (Survey, Walk, Run) — scale 0.02

**World objects** (buildings, props, scenery, collectibles) — generate with Meshy or search free libraries:

| Entity | Meshy Prompt | Fallback Source |
|--------|-------------|-----------------|
| Tree | "a low poly stylized tree, game asset" | Poly Haven |
| House | "a medieval house, low poly game asset" | Poly Haven |
| Barrel | "a wooden barrel, low poly game asset" | Poly Haven |
| Coin | "a gold coin, game collectible item" | Sketchfab |

### Step 4: Generate / Download

**With Meshy (preferred):**
```bash
# Generate characters
MESHY_API_KEY=<key> node <plugin-root>/scripts/meshy-generate.mjs \
  --mode text-to-3d \
  --prompt "a heroic knight, low poly game character, full body" \
  --polycount 15000 --pbr \
  --output public/assets/models/ --slug player

# Rig characters for animation
MESHY_API_KEY=<key> node <plugin-root>/scripts/meshy-generate.mjs \
  --mode rig --task-id <refine-task-id> --height 1.7 \
  --output public/assets/models/ --slug player-rigged

# Generate static props
MESHY_API_KEY=<key> node <plugin-root>/scripts/meshy-generate.mjs \
  --mode text-to-3d \
  --prompt "a wooden barrel, low poly game asset" \
  --polycount 5000 \
  --output public/assets/models/ --slug barrel
```

**Without Meshy (fallback):**
```bash
# Characters — copy from library
cp <plugin-root>/assets/3d-characters/models/Soldier.glb public/assets/models/

# World objects — search and download
node <plugin-root>/scripts/find-3d-asset.mjs --query "barrel" --source polyhaven \
  --output public/assets/models/ --slug barrel
```

### Step 5: Integrate

1. Create `src/level/AssetLoader.js` — **use `SkeletonUtils.clone()` for animated models** (import from `three/addons/utils/SkeletonUtils.js`). Regular `.clone()` breaks skeleton → T-pose.
2. Add `CHARACTER` to Constants.js with `path`, `scale`, `facingOffset`, `clipMap`
3. Add `ASSET_PATHS` and `MODEL_CONFIG` for static models
4. Update `Player.js`:
   - `THREE.Group` as position anchor
   - `loadAnimatedModel()` + `AnimationMixer`
   - `fadeToAction()` for idle/walk/run crossfade
   - Camera-relative WASD via `applyAxisAngle(_up, cameraAzimuth)`
   - Model facing: `atan2(v.x, v.z) + CHARACTER.facingOffset`
   - `model.quaternion.rotateTowards(targetQuat, turnSpeed * delta)`
5. Update `Game.js`:
   - Add `OrbitControls` — third-person camera orbiting player
   - Camera follows: move `orbitControls.target` + `camera.position` by player delta
   - Pass `orbitControls.getAzimuthalAngle()` to Player for camera-relative movement
6. Replace environment primitives with `loadModel()` calls + `.catch()` fallback
7. Add `THREE.GridHelper` for visible movement reference
8. Preload all models on startup with `preloadAll()` for instant loading

### Step 6: Tune & Verify

- Run `npm run dev` — walk around with WASD, orbit camera with mouse
- Confirm character animates (Idle when stopped, Walk when moving, Run with Shift)
- Adjust `MODEL_CONFIG` values (scale, rotationY, offsetY) per model
- Run `npm run build` to confirm no errors
- Generate `ATTRIBUTION.md` from `.meta.json` files

## Example Usage

### With Meshy AI
```
/add-3d-assets examples/space-explorer
```
Result: Generates custom knight model via Meshy → rigs and animates (Idle/Walk/Run) → replaces BoxGeometry player with animated GLB → adds OrbitControls camera → world props from free libraries.

### Without Meshy (fallback)
```
/add-3d-assets examples/3d-platformer
```
Result: Copies Soldier.glb from character library → configures SkeletonUtils.clone() → fadeToAction animation crossfade → replaces all primitives with library/downloaded models.

## Troubleshooting

### Model stuck in T-pose (not animating)
**Cause:** Using `.clone(true)` instead of `SkeletonUtils.clone()` breaks skeleton bindings on animated GLB models.
**Fix:** Always use `SkeletonUtils.clone()` from `three/addons/utils/SkeletonUtils.js` for any model with animations. Regular `.clone()` copies the mesh but not the skeleton bindings.

### Meshy AI generation fails or returns low quality
**Cause:** Vague prompts or wrong generation mode selected.
**Fix:** Use specific, descriptive prompts (e.g., "low-poly medieval wooden treasure chest, game asset" not "chest"). For characters, use image-to-3D mode with a reference image. Set art style to "game-asset" or "low-poly" for better game integration.

### Rigging fails on generated model
**Cause:** The model geometry is not suitable for auto-rigging (too complex, non-manifold, or not humanoid).
**Fix:** Simplify the prompt to produce cleaner geometry. Ensure the model is a single connected mesh in a humanoid pose. Non-humanoid models (props, vehicles) should not be rigged — use them as static assets instead.

### meshopt decoder error on load
**Cause:** Some GLB files use meshopt compression which requires a decoder not loaded by default.
**Fix:** Add the meshopt decoder before loading: `import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js'; loader.setMeshoptDecoder(MeshoptDecoder);`

### Model facing wrong direction
**Cause:** Different model sources use different forward directions. Mixamo models face -Z, some others face +Z.
**Fix:** Store a `facingOffset` per character model. Apply it as `model.rotation.y = facingOffset + movementAngle`. Common values: Soldier/Xbot need `+Math.PI`, Robot/Fox need `+0`.

## Next Step

Tell the user:

> Your 3D game now has custom models! Characters were generated with Meshy AI (or sourced from the model library), rigged, and animated. World objects are loaded from GLB files.
>
> **Files created:**
> - `src/level/AssetLoader.js` — model loader with SkeletonUtils
> - `public/assets/models/` — generated and downloaded GLB models
> - OrbitControls third-person camera
>
> **Controls:** WASD to move, Shift to run, mouse drag to orbit camera, scroll to zoom.
> Run the game to see everything in action. Adjust `MODEL_CONFIG` in Constants.js to fine-tune scale and orientation.

© OpusGameLabs · MIT · PlayableIntelligence/game-creator

Похожие скиллы

Всё по теме «Геймдев и 3D: Unity, Unreal, Godot, Blender» →
fal-regenerate-3d fal-ai-community Собирает интерактивную 3D-витрину персонажей на Three.js с анимациями, видеофонами и PBR-покрытием пола через модели fal.ai. CX Codex +1 390установок meshy-3d-generation meshy-dev Создаёт 3D-модели, текстурирует меши и настраивает анимации через Meshy CLI 0.4.3. Пригодится при добавлении файлов GLB и glTF в проект прямо из терминала. CX Codex +1 2 300установок build-rigged-game-assets MengTo Скилл ведёт сборку игрового персонажа или монстра от исходной модели до загрузки в геймплей: риг, библиотека анимаций, сокеты, экипировка, каталог. CX Codex +1 1 200установок scenario-meshy scenario-labs Скилл ведёт агента по конвейеру Meshy на Scenario: генерация меша, ретекстуринг, ремеш, UV-развёртка, риггинг и анимация. Пригодится, если делаете GLB для движка. CX Codex +1 433установок build-vesperfall-review-assets MengTo Скилл формирует пары для ревью ассетов каталога Vesperfall: прозрачный PNG-референс и живую модель Three.js или FBX. Пригодится при добавлении персонажей, оружия и проверке наборов анимаций. CX Codex +1 1 200установок spritecook-animate-assets SpriteCook Скилл для анимации игровых ассетов через SpriteCook MCP: превращает готовый спрайт в короткую пиксельную или детальную анимацию. CX Codex +1 1 000установок

Из того же набора27

add-audio Скилл добавляет в браузерную игру фоновую музыку и звуковые эффекты на Web Audio API. Никаких аудиофайлов и npm-пакетов — всё синтезируется в браузере. CX Codex +1 1 000установок add-assets Заменяет круги и прямоугольники в 2D-игре на пиксель-арт спрайты персонажей, врагов и предметов. Пригодится, когда прототип уже играется, а смотреть на него больно. CX Codex +1 997установок add-feature Добавляет игровую механику в браузерную игру на Three.js или Phaser. Пригодится, когда нужно внедрить бонусы, комбо или двойной прыжок без поломки архитектуры проекта. CX Codex +1 977установок review-game Проводит аудит игрового проекта: архитектура, производительность, качество кода и готовность к монетизации. Только чтение, без правок. CX Codex +1 954установок qa-game Скилл настраивает автотесты на Playwright для веб-игры: проверяет запуск, переход между сценами, счёт, снимки экранов и FPS. Пригодится для быстрой проверки механики без ручных тестов. CX Codex +1 931установок meshyai Генерирует 3D-модели из текста или картинки через Meshy AI, ставит скелет на гуманоидов и добавляет анимации ходьбы и бега для Three.js. CX Codex +1 907установок quick-game Генерирует черновой играбельный прототип на Phaser или Three.js без графики, звука и полировки. Пригодится, когда нужно сразу запустить и проверить базовую механику. CX Codex +1 866установок monetize-game Регистрирует браузерную игру на Play.fun, подключает клиентский SDK с очками и таблицей лидеров, а затем выдаёт ссылку для игроков. CX Codex +1 862установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой