add-3d-assets
npx skills add https://github.com/opusgamelabs/game-creator --skill add-3d-assets
Agent 安装分布
Skill 文档
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. If not, 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:
- Sign up at https://app.meshy.ai
- Go to Settings â API Keys
- Create a new API key
What is your Meshy API key? (Or type “skip” to use free model libraries instead)
Step 2: Audit
- Read
package.jsonto confirm this is a Three.js game (not Phaser â use/add-assetsfor 2D games) - Read
src/core/Constants.jsfor entity types, sizes, colors - Read entity files (
src/gameplay/*.js,src/entities/*.js) â findBoxGeometry,SphereGeometry, etc. - Read
src/level/LevelBuilder.jsfor 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 3d-character-library/:
- 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):
# 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):
# Characters â copy from library
cp <plugin-root>/3d-character-library/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
- Create
src/level/AssetLoader.jsâ useSkeletonUtils.clone()for animated models (import fromthree/addons/utils/SkeletonUtils.js). Regular.clone()breaks skeleton â T-pose. - Add
CHARACTERto Constants.js withpath,scale,facingOffset,clipMap - Add
ASSET_PATHSandMODEL_CONFIGfor static models - Update
Player.js:THREE.Groupas position anchorloadAnimatedModel()+AnimationMixerfadeToAction()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)
- Update
Game.js:- Add
OrbitControlsâ third-person camera orbiting player - Camera follows: move
orbitControls.target+camera.positionby player delta - Pass
orbitControls.getAzimuthalAngle()to Player for camera-relative movement
- Add
- Replace environment primitives with
loadModel()calls +.catch()fallback - Add
THREE.GridHelperfor visible movement reference - 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_CONFIGvalues (scale, rotationY, offsetY) per model - Run
npm run buildto confirm no errors - Generate
ATTRIBUTION.mdfrom.meta.jsonfiles
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 SkeletonUtilspublic/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_CONFIGin Constants.js to fine-tune scale and orientation.