add-3d-assets by opusgamelabs/game-creator
npx skills add https://github.com/opusgamelabs/game-creator --skill add-3d-assets用真实的 3D 模型替换基础的几何形状(BoxGeometry、SphereGeometry)。角色使用 Meshy AI 生成的带有骨骼绑定和动画的自定义模型。世界对象则从免费库中生成或获取。
分析位于 $ARGUMENTS 的游戏(如果未提供路径,则分析当前目录)。
首先,加载 game-3d-assets 技能和 meshyai 技能,以获取完整的模型流水线、AssetLoader 模式、Meshy 生成和集成模式。
检查 MESHY_API_KEY 是否已设置。首先检查 .env 文件:test -f .env && grep -q '^MESHY_API_KEY=.' .env && echo "found" 如果找到,使用 set -a; . .env; set +a 导出它并跳过提示。
如果未设置,询问用户:
我将使用 Meshy AI 生成自定义 3D 模型以获得最佳效果。您可以在 30 秒内获得一个免费的 API 密钥:
- 在 注册
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
在下方粘贴您的密钥,格式如:
MESHY_API_KEY=your-key-here(它将自动保存到 .env 文件并从本次对话中隐去。)或者输入 "skip" 以使用免费的模型库。
package.json 以确认这是一个 Three.js 游戏(不是 Phaser —— 对于 2D 游戏请使用 /add-assets)src/core/Constants.js 以获取实体类型、尺寸、颜色src/gameplay/*.js, src/entities/*.js)—— 查找 BoxGeometry、SphereGeometry 等src/level/LevelBuilder.js 以获取环境基础元素将实体分为两类:
动画角色(玩家、带有 AI 的敌人)—— 使用 Meshy AI 生成:
| 实体 | Meshy 提示词 | 备注 |
|---|---|---|
| 玩家 | "一个英勇的骑士,低多边形游戏角色,全身,T 姿势" | 生成 → 骨骼绑定 → 动画 |
| 敌人 | "一个拿着棍棒的哥布林战士,低多边形游戏角色" | 生成 → 骨骼绑定 → 动画 |
如果 Meshy 不可用,则回退到 3d-character-library/:
世界对象(建筑、道具、场景、可收集物品)—— 使用 Meshy 生成或从免费库中搜索:
| 实体 | Meshy 提示词 | 备用来源 |
|---|---|---|
| 树 | "一棵低多边形风格化的树,游戏资源" | Poly Haven |
| 房屋 | "一座中世纪房屋,低多边形游戏资源" | Poly Haven |
| 木桶 | "一个木制桶,低多边形游戏资源" | Poly Haven |
| 金币 | "一枚金币,游戏可收集物品" | Sketchfab |
使用 Meshy(首选):
# 生成角色
MESHY_API_KEY=<key> node <plugin-root>/scripts/meshy-generate.mjs \
--mode text-to-3d \
--prompt "一个英勇的骑士,低多边形游戏角色,全身" \
--polycount 15000 --pbr \
--output public/assets/models/ --slug player
# 为角色绑定骨骼以制作动画
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
# 生成静态道具
MESHY_API_KEY=<key> node <plugin-root>/scripts/meshy-generate.mjs \
--mode text-to-3d \
--prompt "一个木制桶,低多边形游戏资源" \
--polycount 5000 \
--output public/assets/models/ --slug barrel
不使用 Meshy(回退方案):
# 角色 —— 从库中复制
cp <plugin-root>/3d-character-library/models/Soldier.glb public/assets/models/
# 世界对象 —— 搜索并下载
node <plugin-root>/scripts/find-3d-asset.mjs --query "barrel" --source polyhaven \
--output public/assets/models/ --slug barrel
src/level/AssetLoader.js —— 对于动画模型,使用 SkeletonUtils.clone()(从 three/addons/utils/SkeletonUtils.js 导入)。常规的 .clone() 会破坏骨骼 → T 姿势。CHARACTER,包含 path、scale、facingOffset、clipMapASSET_PATHS 和 MODEL_CONFIGPlayer.js:
THREE.Group 作为位置锚点loadAnimatedModel() + AnimationMixerfadeToAction() 用于 idle/walk/run 的淡入淡出过渡applyAxisAngle(_up, cameraAzimuth) 实现相机相对方向的 WASD 移动atan2(v.x, v.z) + CHARACTER.facingOffsetmodel.quaternion.rotateTowards(targetQuat, turnSpeed * delta)Game.js:
OrbitControls —— 第三人称相机环绕玩家orbitControls.target + camera.positionorbitControls.getAzimuthalAngle() 传递给 Player 以进行相机相对移动loadModel() 调用和 .catch() 回退替换环境基础元素THREE.GridHelper 作为可见的移动参考preloadAll() 预加载所有模型以实现即时加载npm run dev —— 使用 WASD 移动,鼠标环绕相机MODEL_CONFIG 值(scale, rotationY, offsetY)npm run build 以确认没有错误.meta.json 文件生成 ATTRIBUTION.md/add-3d-assets examples/space-explorer
结果:通过 Meshy 生成自定义骑士模型 → 绑定骨骼并制作动画(Idle/Walk/Run)→ 用动画 GLB 替换 BoxGeometry 玩家 → 添加 OrbitControls 相机 → 世界道具来自免费库。
/add-3d-assets examples/3d-platformer
结果:从角色库复制 Soldier.glb → 配置 SkeletonUtils.clone() → fadeToAction 动画淡入淡出过渡 → 用库中/下载的模型替换所有基础元素。
原因: 使用 .clone(true) 而不是 SkeletonUtils.clone() 会破坏动画 GLB 模型的骨骼绑定。修复: 对于任何带有动画的模型,始终使用来自 three/addons/utils/SkeletonUtils.js 的 SkeletonUtils.clone()。常规的 .clone() 会复制网格但不会复制骨骼绑定。
原因: 提示词模糊或选择了错误的生成模式。修复: 使用具体、描述性的提示词(例如,"低多边形中世纪木制宝箱,游戏资源" 而不是 "箱子")。对于角色,使用带有参考图像的 image-to-3D 模式。将艺术风格设置为 "game-asset" 或 "low-poly" 以获得更好的游戏集成效果。
原因: 模型几何形状不适合自动骨骼绑定(太复杂、非流形或非人形)。修复: 简化提示词以生成更干净的几何形状。确保模型是处于人形姿势的单个连接网格。非人形模型(道具、载具)不应进行骨骼绑定 —— 应将其用作静态资源。
原因: 一些 GLB 文件使用了 meshopt 压缩,这需要一个默认未加载的解码器。修复: 在加载前添加 meshopt 解码器:import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js'; loader.setMeshoptDecoder(MeshoptDecoder);
原因: 不同的模型来源使用不同的前向方向。Mixamo 模型朝向 -Z,其他一些朝向 +Z。修复: 为每个角色模型存储一个 facingOffset。将其应用为 model.rotation.y = facingOffset + movementAngle。常见值:Soldier/Xbot 需要 +Math.PI,Robot/Fox 需要 +0。
告诉用户:
您的 3D 游戏现在拥有自定义模型了!角色已通过 Meshy AI 生成(或从模型库获取),并进行了骨骼绑定和动画制作。世界对象从 GLB 文件加载。
创建的文件:
src/level/AssetLoader.js—— 带有 SkeletonUtils 的模型加载器public/assets/models/—— 生成和下载的 GLB 模型- OrbitControls 第三人称相机
控制方式: WASD 移动,Shift 奔跑,鼠标拖拽环绕相机,滚轮缩放。运行游戏以查看所有效果。在 Constants.js 中调整
MODEL_CONFIG以微调缩放和方向。
每周安装次数
81
仓库
GitHub 星标数
26
首次出现
2026年2月26日
安全审计
已安装于
claude-code69
opencode41
gemini-cli40
github-copilot40
amp40
codex40
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.
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.
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:
- Sign up at https://app.meshy.ai
- Go to Settings → API Keys
- 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.
package.json to confirm this is a Three.js game (not Phaser — use /add-assets for 2D games)src/core/Constants.js for entity types, sizes, colorssrc/gameplay/*.js, src/entities/*.js) — find BoxGeometry, SphereGeometry, etc.src/level/LevelBuilder.js for environment primitivesSplit 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/:
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 |
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
src/level/AssetLoader.js — useSkeletonUtils.clone() for animated models (import from three/addons/utils/SkeletonUtils.js). Regular .clone() breaks skeleton → T-pose.CHARACTER to Constants.js with path, scale, facingOffset, clipMapASSET_PATHS and MODEL_CONFIG for static modelsnpm run dev — walk around with WASD, orbit camera with mouseMODEL_CONFIG values (scale, rotationY, offsetY) per modelnpm run build to confirm no errorsATTRIBUTION.md from .meta.json files/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.
/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.
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.
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.
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.
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);
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.
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.
Weekly Installs
81
Repository
GitHub Stars
26
First Seen
Feb 26, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykFail
Installed on
claude-code69
opencode41
gemini-cli40
github-copilot40
amp40
codex40
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
44,900 周安装
Vue.js 测试最佳实践指南:Vue 3 单元测试、组件测试与常见问题解决方案
8,600 周安装
Microsoft 代码参考工具 - 查找API、代码示例与错误排查,提升Azure开发效率
8,700 周安装
如何创建AGENTS.md文件 - AI编码助手项目文档指南与模板
8,700 周安装
AI项目架构蓝图生成器:自动分析代码生成架构文档,支持.NET/Java/React等
8,700 周安装
Swift并发编程指南:最佳实践、快速修复与迁移策略
8,600 周安装
Azure DevOps CLI 完整指南:安装、身份验证与命令大全(2025最新版)
8,900 周安装
Player.js:
THREE.Group as position anchorloadAnimatedModel() + AnimationMixerfadeToAction() for idle/walk/run crossfadeapplyAxisAngle(_up, cameraAzimuth)atan2(v.x, v.z) + CHARACTER.facingOffsetmodel.quaternion.rotateTowards(targetQuat, turnSpeed * delta)Game.js:
OrbitControls — third-person camera orbiting playerorbitControls.target + camera.position by player deltaorbitControls.getAzimuthalAngle() to Player for camera-relative movementloadModel() calls + .catch() fallbackTHREE.GridHelper for visible movement referencepreloadAll() for instant loading