跳过主要内容
B3D
Skill免费GameSkill 出品GameSkill 原创

AI Mesh Weapon Rig (split, rig, fire/reload, FPS viewmodel)

/ai-mesh-weapon-rig

A GameSkill original that turns one fictional prop mesh into a first-person viewmodel GLB. It splits the mesh by material or baked texture colour from a small parts spec, rigs rigid parts on root, slide, trigger and mag bones with muzzle, eject, mag and grip sockets, bakes fire, reload and inspect clips, measures the mechanism and checks the GLB. A three.js FPS viewer plays the clips and puts the muzzle flash on the socket. Prototype quality: generated meshes still need cleanup.

许可证
MIT
出品
GameSkill 出品
下载 ZIP

我们测过

在 Blender 5.2.3 LTS (background) + three.js r186 in Chrome 156 headless 上通过 45/45 项检查(2026-10-28):能触发、有可运行示例、有截图和自检清单、单一职责、中英文文档齐全。触发检查是把提示词和 skill 描述做匹配,不是真实 agent 运行。

测试报告

GameSkill 测过的版本

GameSkill 为 gameskill.dev 原创编写并测过。ZIP 里是完整的 skill:SKILL.md 及中文版、脚本、可运行示例、测试、自检清单和我们的测试报告。

下载测过的 ZIP(1.5 MB)路线图:美术资产

GameSkill 原创,协议 MIT。ZIP 保留 LICENSE 和 CREDITS.md,里面列出了流程灵感来源、CC0 测试素材和第三方库及其协议。

AI Mesh Weapon Rig (split, rig, fire/reload, FPS viewmodel)

自检清单

  • 道具是虚构的,名字、零件名和贴图里没有真实枪械、厂商或游戏 / The prop is invented; no real firearm, maker or game in names, parts or textures
  • check-spec 通过,颜色太接近的零件都有位置规则 / check-spec passes and close colours have a position hint
  • 机构检查全部通过:弹匣完整掉出、滑盖行程够、枪口在最前 / Mechanism check passes: mag clears, slide travels, muzzle at the front
  • validate-glb 通过:每个顶点只绑一根骨骼,三段动画和四个挂点都在 / validate-glb passes: one bone per vertex, three clips, four sockets
  • AI 网格看过补洞前后的开放边和渲染图,已经告诉用户要清理什么 / For an AI mesh, open edges and renders were read and the cleanup was named
  • 在 viewer 里开火、R、F 都播对了动画,枪口焰在喷嘴前 / In the viewer, shoot, R and F play the right clips and the flash is at the nozzle

中文指南

这个 skill 做什么

GameSkill 出品(MIT),原型级。把一个虚构道具的网格(手做的,或者用图生 3D 模型生成的)变成第一人称视图模型 GLB:

  • 按配色表用材质或烘焙贴图颜色拆件,摆正方向,缩放到实际尺寸;
  • 零件刚性绑在 root、slide、trigger、mag 四根骨骼上,另有枪口、抛壳、弹匣、握把四个挂点;
  • 做开火、换弹、检视三段动画;
  • 测量机构,检查 GLB;
  • 最后放进 three.js 第一人称示例里实际开火、换弹。

什么时候用

  • 用 AI 生成了一个小工具、玩具枪或科幻道具,想拆成能动的零件放进 FPS 原型
  • 要给第一人称道具绑骨骼、加挂点、做开火和换弹动画
  • 想在进引擎前检查一个视图模型 GLB

怎么装

下载本页的 ZIP,把 ai-mesh-weapon-rig/ 文件夹放进 .claude/skills/(Claude Code)或 .agents/skills/(Codex、Cursor),重启 agent。需要 Blender 4.2 以上和 Node.js 20 以上。

最小示例

示例是“铆钉发射器”,一个虚构的玩具工具,由六个封闭的基本体组成。

  1. node tools/check-spec.mjs example/rivet-launcher.parts.json 检查配色表,并打印写进提示词的颜色。
  2. blender -b --factory-startup -P blender/rig_prop.py -- --spec example/rivet-launcher.parts.json --out out/rivet-launcher.glb 生成 632 个三角面、88 KB 的 GLB。
  3. node tools/validate-glb.mjs out/rivet-launcher.glb 检查结果。
  4. 打开 viewer/index.html,按住左键开火,按 R 换弹,按 F 检视。

AI 路线多传 --obj 和 --texture 两个参数。

预计要清理

我们用 TripoSR 生成的铆钉发射器网格实测过。朝向、拆件和机构都跑通了,但有三个问题:

  • 生成器不做内部,弹匣掉出来后机身是空的;
  • 补洞后机身还有 223 条开放边,接缝处有细碎片;
  • 表面软塌。

每个生成的道具预计要在 Blender 里清理 30–60 分钟,适合灰盒和 game jam,不适合主角武器。

我们怎么测的

  • npm test:10 个 Node 测试,覆盖配色表检查、GLB 读取和验证、随包示例和命令行退出码。
  • npm run test:blender:11 项检查。
    • 重新构建示例:六个零件都封闭,机构检查通过,结果和随包 GLB 一致,输出姿势渲染图。
    • 用替身网格走一遍 AI 路线:把示例重新网格化成一整块、颜色烘焙进贴图、转个斜角后,按颜色拆回六个零件。
  • npm run test:browser:在无头 Chrome 里做 9 项检查,覆盖每发子弹播开火、枪口焰亮在挂点上、按住开火时换弹不被打断、检视、方块枪回退、加载失败提示。

致谢

把 AI 网格拆件、绑成第一人称武器的思路来自 @Graalitoo 的帖子(只放链接,没有使用任何代码、网格或文件)。测试用了 TripoSR(MIT),本包不附带它。viewer 改自我们自己的 threejs-fps-weapon-feel,three.js 是 MIT 许可。

搭配

  • threejs-fps-weapon-feel:后坐、弹道散布、瞄准手感
  • blender-export-pipelines:导出到各引擎的预设
  • threejs-glb-scene-assembly:在 three.js 场景里加载 GLB

安装

告诉你的 AI

Install the skill from https://gameskill.dev/skills/ai-mesh-weapon-rig/install.md

GameSkill 测过的版本

测过的版本装到 .claude/skills/
mkdir -p .claude/skills
curl -fsSL https://gameskill.dev/dl/skills/ai-mesh-weapon-rig.zip -o /tmp/gameskill-ai-mesh-weapon-rig.zip
unzip -oq /tmp/gameskill-ai-mesh-weapon-rig.zip -d .claude/skills
rm /tmp/gameskill-ai-mesh-weapon-rig.zip

包含内容

  • blender/rig_prop.py: split by colour, orient, rigid rig with sockets, fire / reload / inspect clips, mechanism check, GLB export
  • tools/check-spec.mjs: parts-spec linter (close colours, real-gun names, orientation) that prints the prompt colours
  • tools/validate-glb.mjs: dependency-free viewmodel GLB check (bones, sockets, clip lengths, rigid weights, budget)
  • viewer/: our Pier Range FPS example playing the clips on shoot, R and F with the flash on socket_muzzle
  • Fictional rivet launcher example, 10 Node tests, 11 Blender checks and 9 browser checks

适合

  • Gadget, tool or toy-weapon props for a first-person prototype or game jam
  • Turning an AI-generated prop into something with moving parts in an afternoon
  • Checking a viewmodel GLB before it goes into the engine

不适合

  • Hero weapons ready to ship: generated meshes need 30-60 minutes of cleanup each
  • Real firearms, manufacturer designs or another game's weapons
  • Recoil and gun feel: see threejs-fps-weapon-feel

试试这条提示词

提示词
I generated a toy rivet launcher with an image-to-3D model. Split it into body, grip, trigger, cover and cartridge, rig it for first person with fire and reload, and put it in my three.js FPS.

关于这个 Skill

A GameSkill original, prototype quality. One Blender script turns a fictional prop mesh into a rigged first-person viewmodel GLB. The mesh can be hand-built or generated from an image. Two Node tools check the parts spec and the GLB, and our Pier Range FPS example plays the clips.

Agent steps

  1. Spec: one flat, distinct colour and one bone per moving part, plus two strongly coloured part pairs for orientation and a position hint for colours that are too close. Run check-spec, and for the AI route put its colours in the image prompt.
  2. Build: run rig_prop.py with the hand-built primitives, or with --obj and --texture for a generated mesh.
  3. Read the report: fragments per part, open edges before and after capping, and the mechanism (the mag clears the body, the slide travels, the muzzle is at the front).
  4. Validate the GLB: bones, sockets, clip lengths, one bone per vertex, triangle budget.
  5. Hook it up: load it as the viewmodel, play fire per shot and reload on R, and put the muzzle flash on socket_muzzle.
  6. Name the cleanup for generated meshes: there is no interior, the cut seams are jagged, and the surface is blobby. Expect 30-60 minutes per prop.

Common errors it fixes

  • An OBJ that looks like thousands of loose pieces (unwelded UV seams), or that comes out 90° off (the importer's rotation).
  • Grey parts that get mixed up or tilt the orientation.
  • Smooth auto-weights that bend rigid parts, and a muzzle flash that floats away from the barrel.

Credits

The idea comes from a post by @Graalitoo (link only; no code, mesh or file was used). TripoSR (MIT) was used in testing and is not shipped. The viewer is adapted from our own threejs-fps-weapon-feel, and three.js is MIT. The code, the prop and the text are ours.

环境要求

  • Blender 4.2+ (tested on 5.2.3), run headless; no add-ons or Python packages
  • Node.js 20+ for the spec linter and GLB validator; Chrome for the optional viewer test
  • For the AI route: an image-to-3D model you may use (tested with TripoSR, MIT) and a part-coloured, fictional design

相关主题

常见问题

基于 AI mesh split and rigged as a first-person weapon (post, link only) (作者 @Graalitoo,no licence, idea only, no code, mesh or file used)的思路。代码和文字由 GameSkill 编写,ZIP 里的 CREDITS.md 列出所有来源。 · 基于 TripoSR (image-to-3D model used in our tests, not shipped) (作者 Tripo AI & Stability AI,MIT)的思路。代码和文字由 GameSkill 编写,ZIP 里的 CREDITS.md 列出所有来源。

搭配使用

作者标注的相关 Skills,或更适合相邻任务的 Skills。

相似 skills