@genex-ai/cli-demo 1.34.1-dev.695 → 1.34.2-dev.697

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genex-ai/cli-demo",
3
- "version": "1.34.1-dev.695",
3
+ "version": "1.34.2-dev.697",
4
4
  "description": "Set up your project's agent workspace (.claude/.codex/.cursor in the game folder), authorize, create a game project, generate AI assets, and publish (genex CLI).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -64,6 +64,30 @@ export interface ColliderOptions {
64
64
  const massPropertiesConflictError =
65
65
  "Please pick ONLY ONE of the `density`, `mass` and `massProperties` options.";
66
66
 
67
+ // Diagnose invalid root/body wiring once per body, without changing the
68
+ // upstream-compatible root-relative placement or retaining disposed bodies.
69
+ const warnedColliderBodies = new WeakSet<RAPIER.RigidBody>();
70
+
71
+ function warnMismatchedColliderFrame(body: RAPIER.RigidBody, root: THREE.Object3D): void {
72
+ if (warnedColliderBodies.has(body)) return;
73
+ const position = root.getWorldPosition(new THREE.Vector3());
74
+ const rotation = root.getWorldQuaternion(new THREE.Quaternion());
75
+ const t = body.translation();
76
+ const r = body.rotation();
77
+ const distance = Math.hypot(position.x - t.x, position.y - t.y, position.z - t.z);
78
+ // q and -q describe the same rotation.
79
+ const rotationDifference = 1 - Math.abs(rotation.dot(new THREE.Quaternion(r.x, r.y, r.z, r.w)));
80
+ if (distance <= 1e-4 && rotationDifference <= 1e-6) return;
81
+ warnedColliderBodies.add(body);
82
+ console.warn(
83
+ "[GENEX_COLLIDER_FRAME_MISMATCH] collidersFromObject uses its root as the body's frame, " +
84
+ "but their world poses differ. This can put invisible collisions away from the rendered meshes. " +
85
+ "Pass the root registered to this body, or use convexHullColliderFromMesh / " +
86
+ "trimeshColliderFromMesh for separate meshes attached to a shared body. " +
87
+ "Trimeshes are for static geometry only. Collider placement was not changed.",
88
+ );
89
+ }
90
+
67
91
  /**
68
92
  * Auto-generate one collider per visible mesh under `object3d` — the vanilla
69
93
  * equivalent of the upstream `<RigidBody colliders="...">` prop. Works on GLB
@@ -82,6 +106,7 @@ export function collidersFromObject(
82
106
  ): RAPIER.Collider[] {
83
107
  const colliders: RAPIER.Collider[] = [];
84
108
  object3d.updateWorldMatrix(true, false);
109
+ warnMismatchedColliderFrame(body, object3d);
85
110
  const invertedRootMatrix = object3d.matrixWorld.clone().invert();
86
111
  const rootWorldScale = object3d.getWorldScale(new THREE.Vector3());
87
112
 
@@ -35,7 +35,12 @@ cuboidCollider(world, groundBody, [45, 0.25, 45], { friction: 1 }); // HALF exte
35
35
  For loaded GLB level pieces, `collidersFromObject(world, body, gltf.scene, "trimesh")`
36
36
  auto-generates colliders per mesh (`"hull"` for dynamic props from
37
37
  `$genex-ai-model`; `"trimesh"` only on static geometry). `cuboidCollider`
38
- takes **half** extents — do not halve twice.
38
+ takes **half** extents — do not halve twice. The auto-collider root must be
39
+ the object registered to that body. For separate positioned obstacles sharing
40
+ one fixed body, call `convexHullColliderFromMesh` per mesh (or
41
+ `trimeshColliderFromMesh` for concave static surfaces). Passing each leaf to
42
+ `collidersFromObject` rebases it to the body origin; a
43
+ `GENEX_COLLIDER_FRAME_MISMATCH` warning identifies this wiring error.
39
44
 
40
45
  ## 3. Character
41
46
 
@@ -96,7 +96,22 @@ trimeshColliderFromMesh(world, fixedBody, levelMesh, { friction: 1 });
96
96
  ```
97
97
 
98
98
  Both bake the mesh's current world transform relative to the body, so the
99
- collider lands exactly where the mesh renders.
99
+ collider lands where the mesh renders. For several positioned obstacles on
100
+ one fixed body, use these helpers per mesh; do not call `collidersFromObject`
101
+ with each leaf as the root of that same body:
102
+
103
+ ```ts
104
+ const obstaclesBody = physics.createBody({ type: "fixed" });
105
+ for (const obstacle of obstacleMeshes) {
106
+ convexHullColliderFromMesh(world, obstaclesBody, obstacle, { friction: 1 });
107
+ }
108
+ ```
109
+
110
+ Use trimeshes instead for concave static surfaces. A
111
+ `GENEX_COLLIDER_FRAME_MISMATCH` warning means the auto-collider root and body
112
+ have different world poses. Check visible geometry against collisions; the
113
+ warning does not repair their placement. Correctly registered roots keep the
114
+ existing auto-collider behavior.
100
115
 
101
116
  ## Hull vs trimesh
102
117