@combos-fun/plugin-renderer-3d-model 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # @combos-fun/plugin-renderer-3d-model
2
+
3
+ @combos-fun/plugin-renderer-3d-model — part of the Combos Fun engine monorepo.
4
+
5
+ Keywords: `3d`, `model`, `glb`, `gltf`, `animation`, `mesh`.
6
+
7
+ ## Documentation
8
+
9
+ - Per-package agent / developer notes: [`agent-skill.md`](./agent-skill.md)
10
+ - Machine-readable manifest: [`combos-plugin.json`](./combos-plugin.json)
11
+ (validated against `schemas/combos-plugin.schema.json` in the repo
12
+ root)
13
+ - Entry skill (single source of truth for AI agents working with this
14
+ monorepo): `skills/combos-engine-development/SKILL.md`
15
+
16
+ When consumed from npm, the manifest and agent notes are exposed as
17
+ stable subpaths:
18
+
19
+ ```ts
20
+ import manifest from '@combos-fun/plugin-renderer-3d-model/plugin-manifest';
21
+ // or fetch the markdown directly:
22
+ // require.resolve('@combos-fun/plugin-renderer-3d-model/agent-skill')
23
+ ```
24
+
25
+ ## License
26
+
27
+ Internal workspace package, part of the Combos Fun engine monorepo.
package/agent-skill.md ADDED
@@ -0,0 +1,73 @@
1
+ # `@combos-fun/plugin-renderer-3d-model` — Agent notes
2
+
3
+ GLB / GLTF 3D model loader and animator. Loads via `ThreeContext.loadGLB()`
4
+ (GLTFLoader) and drives included animations through Three.js
5
+ `AnimationMixer`.
6
+
7
+ ## When to read
8
+
9
+ Read for any 3D character / prop / scenery model: loading GLB / GLTF
10
+ files, choosing animation clips, scrubbing animation speed.
11
+
12
+ ## Public API
13
+
14
+ ```ts
15
+ import { Model3D, GLBSystem, type Model3DParams } from '@combos-fun/plugin-renderer-3d-model';
16
+ ```
17
+
18
+ `componentName = 'Model3D'`, `systemName = 'GLBSystem'`.
19
+
20
+ ### `Model3DParams`
21
+
22
+ | Field | Type | Default | Notes |
23
+ |-------|------|---------|-------|
24
+ | `resource` | `string` | `''` | GLB / GLTF URL (direct, not engine resource name) |
25
+ | `autoPlay` | `boolean` | `true` | |
26
+ | `animationIndex` | `number` | `0` | Index into the GLB's `animations` array |
27
+ | `speed` | `number` | `1` | `AnimationMixer.timeScale` |
28
+ | `positionX` / `Y` / `Z` | `number` | `0` |
29
+ | `rotationX` / `Y` / `Z` | `number` | `0` |
30
+ | `scaleX` / `Y` / `Z` | `number` | `1` |
31
+
32
+ Changing `animationIndex` or `speed` restarts the animation cleanly.
33
+
34
+ ## Required setup
35
+
36
+ `Renderer3DSystem` then `GLBSystem`. URL must be CORS-accessible and
37
+ return valid binary GLB / JSON GLTF.
38
+
39
+ ## Runtime behaviour
40
+
41
+ - Loading is async. While the GLB is loading, the GameObject has no
42
+ visible mesh.
43
+ - The system uses `increaseAsyncId` / `validateAsyncId` to drop stale
44
+ loads if the component is removed mid-fetch.
45
+ - The `AnimationMixer` is owned by the system; switching
46
+ `animationIndex` calls `mixer.stopAllAction()` then plays the new clip.
47
+
48
+ ## Common pitfalls
49
+
50
+ | Symptom | Fix |
51
+ |---------|-----|
52
+ | Model not visible | Loaded at origin; adjust `position*` or check camera distance (camera is at z=5 by default) |
53
+ | Wrong scale | Use `scaleX` / `Y` / `Z`; many GLBs export at meter scale |
54
+ | Animation doesn't play | `autoPlay: true` is the default — check `animationIndex` is within `animations.length` |
55
+ | Slow / stuttery animation | Lower-end GPU; reduce model polygon count or set `speed < 1` |
56
+ | 404 / CORS | Verify URL returns valid GLB binary; check network tab |
57
+
58
+ ## Minimal example
59
+
60
+ ```ts
61
+ const hero = new GameObject('hero');
62
+ hero.addComponent(new Model3D({
63
+ resource: '/assets/hero.glb',
64
+ autoPlay: true,
65
+ animationIndex: 0,
66
+ speed: 1,
67
+ positionY: 0,
68
+ }));
69
+ ```
70
+
71
+ ## Verification
72
+
73
+ `pnpm --filter @combos-fun/plugin-renderer-3d-model run build`.
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@combos-fun/plugin-renderer-3d-model",
3
+ "pluginId": "renderer-3d-model",
4
+ "category": "rendering",
5
+ "dimension": "3d",
6
+ "isCore": false,
7
+ "keywords": ["3d", "model", "glb", "gltf", "animation", "mesh"],
8
+ "agentSkill": "./agent-skill.md",
9
+ "requires": ["@combos-fun/engine", "@combos-fun/plugin-renderer-3d"],
10
+ "exports": ["Model3D", "GLBSystem"]
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/plugin-renderer-3d-model",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "@combos-fun/plugin-renderer-3d-model",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-3d-model.esm.js",
@@ -9,13 +9,27 @@
9
9
  "types": "dist/plugin-renderer-3d-model.d.ts",
10
10
  "files": [
11
11
  "index.js",
12
- "dist"
12
+ "dist",
13
+ "agent-skill.md",
14
+ "combos-plugin.json"
13
15
  ],
16
+ "exports": {
17
+ ".": {
18
+ "import": "./dist/plugin-renderer-3d-model.esm.js",
19
+ "require": "./index.js",
20
+ "types": "./dist/plugin-renderer-3d-model.d.ts"
21
+ },
22
+ "./plugin-manifest": "./combos-plugin.json",
23
+ "./agent-skill": "./agent-skill.md"
24
+ },
25
+ "combos": {
26
+ "pluginManifest": "./combos-plugin.json"
27
+ },
14
28
  "dependencies": {
15
29
  "three": "^0.172.0",
16
- "@combos-fun/engine": "0.0.6",
17
- "@combos-fun/inspector-decorator": "0.0.6",
18
- "@combos-fun/plugin-renderer-3d": "0.0.6"
30
+ "@combos-fun/engine": "0.0.7",
31
+ "@combos-fun/inspector-decorator": "0.0.7",
32
+ "@combos-fun/plugin-renderer-3d": "0.0.7"
19
33
  },
20
34
  "scripts": {
21
35
  "build": "node ../../scripts/build-package.mjs"