@jgengine/shell 0.12.0 → 0.14.0

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +73 -1
  2. package/dist/CombatPresentation.js +2 -1
  3. package/dist/GameHost.d.ts +2 -0
  4. package/dist/GameHost.js +25 -2
  5. package/dist/GamePlayerShell.js +15 -1
  6. package/dist/Shell3dPresentation.js +2 -2
  7. package/dist/camera/GameOrbitCamera.js +7 -1
  8. package/dist/camera/cameraCollision.d.ts +28 -0
  9. package/dist/camera/cameraCollision.js +34 -0
  10. package/dist/camera/cameraRigs.js +8 -8
  11. package/dist/camera/index.d.ts +1 -0
  12. package/dist/camera/index.js +1 -0
  13. package/dist/camera/rigMath.d.ts +7 -0
  14. package/dist/camera/rigMath.js +16 -0
  15. package/dist/devtools/CollisionDebugWorld.js +15 -1
  16. package/dist/devtools/collisionDebugMath.d.ts +8 -0
  17. package/dist/devtools/collisionDebugMath.js +14 -5
  18. package/dist/environment/EnvironmentScene.js +6 -1
  19. package/dist/environment/RoadJunctions.d.ts +12 -0
  20. package/dist/environment/RoadJunctions.js +69 -0
  21. package/dist/environment/RoadRibbons.d.ts +8 -2
  22. package/dist/environment/RoadRibbons.js +26 -8
  23. package/dist/postfx/PostProcessing.js +27 -2
  24. package/dist/postfx/postfxOverlay.d.ts +24 -0
  25. package/dist/postfx/postfxOverlay.js +35 -0
  26. package/dist/presentationResolve.d.ts +5 -1
  27. package/dist/presentationResolve.js +3 -1
  28. package/dist/render/EntityPreview.d.ts +53 -0
  29. package/dist/render/EntityPreview.js +23 -0
  30. package/dist/render/PartMotion.d.ts +18 -0
  31. package/dist/render/PartMotion.js +91 -0
  32. package/dist/render/SceneModels.d.ts +9 -2
  33. package/dist/render/SceneModels.js +43 -179
  34. package/dist/render/measureBounds.d.ts +34 -0
  35. package/dist/render/measureBounds.js +131 -0
  36. package/dist/render/measureCollisionMesh.d.ts +26 -0
  37. package/dist/render/measureCollisionMesh.js +108 -0
  38. package/dist/render/resolveModel.js +16 -10
  39. package/dist/render/useModelAnimation.d.ts +10 -0
  40. package/dist/render/useModelAnimation.js +198 -0
  41. package/dist/structures/GeneratedBuilding.d.ts +4 -0
  42. package/dist/structures/GeneratedBuilding.js +17 -7
  43. package/dist/world/WorldHud.d.ts +3 -1
  44. package/dist/world/WorldHud.js +2 -2
  45. package/dist/world/WorldScene.js +3 -2
  46. package/package.json +4 -4
  47. package/skills/jgengine/SKILL.md +5 -2
  48. package/skills/jgengine/api.md +13 -5
  49. package/skills/jgengine-ui/SKILL.md +9 -4
  50. package/skills/jgengine-ui/api.md +138 -8
  51. package/skills/jgengine-ui/capabilities.md +72 -0
  52. package/skills/jgengine-ui/reference.md +40 -3
  53. package/skills/jgengine-world/api.md +82 -25
  54. package/skills/jgengine-world/capabilities.md +12 -4
  55. package/skills/jgengine-world/reference.md +1 -1
@@ -115,7 +115,7 @@ Turn data-only placement into the build tooling of Valheim/Enshrouded/The Sims/F
115
115
 
116
116
  **Body shape: box or sphere.** `AddBodyOptions` is a discriminated union — `{ shape?: "box", halfExtents }` (box is the default, `shape` omittable) or `{ shape: "sphere", radius }` (the radius fills all three half-extent columns, so broadphase/bounds see the sphere's enclosing AABB). `world.shape[i]` (`SHAPE_BOX` / `SHAPE_SPHERE`) reports a live body's shape for a consumer walking the raw SoA arrays. Sphere-sphere and sphere-box pairs resolve with a proper radial normal (not the axis-aligned box/box path) — balls, projectile bodies, and rolling debris collide correctly against both boxes and each other.
117
117
 
118
- **Collision shapes are box/sphere/voxel — plus opt-in triangle meshes for raycasts and mesh-accurate walk obstruction.** Every collider in the engine — `PhysicsWorld` bodies (box `halfExtents` or sphere `radius`), object/entity picking (`scene/objectQuery` raycasts against unit boxes), and `world/voxelField`/`world/carve` blocks — is an axis-aligned box, a sphere, or a voxel cell. The one exception is opted-in catalog assets: an asset listed in `@jgengine/assets` `COLLISION_MESH_ASSET_IDS` ships a compact quantized triangle mesh in the generated index (`scene/collisionMesh` `CollisionMeshData`, extracted from the GLB at reindex — never from the rendered scene, so a headless host resolves the same shape) **plus a deterministic compound-box decomposition** (`voxelizeToBoxes` → `CollisionMeshData.boxes`, a voxel-rasterize + column-fill + greedy-merge of the model's solid volume). Collider auto-fit then (a) raycasts the actual triangles through a precomputed BVH — shots pass through a torus hole or an archway instead of hitting the fitted box; and (b) exposes the compound boxes on the fitted `mesh` `ColliderShape` (`ColliderShape.mesh.boxes`, scaled/translated onto the placement like the mesh). The `collideObjects` walk controller consumes these in `stepPlayerMovement` (host and client alike, so parity is automatic): it gathers obstacles from resolved blocking physical colliders via a bounded `object.inBox` broadphase (reach ≥ radius + max half-extent, so a wide wall's full span blocks, not a phantom 1 m box), carries each collider's real `halfExtents`/`offset` — or, for a mesh collider, the compound sub-boxes — yaw-rotated onto the obstacle, and slides the capsule against **each** sub-box (`resolveObstacleStep`), so a capsule walks THROUGH an archway opening and is stopped by its pillars/lintel/sill. `PhysicsWorld` and overlap tests still see the conservative fitted AABB; objects with no resolved collider keep today's default box, objects whose colliders don't block stop obstructing, and non-opted assets keep the fitted box everywhere. The seams for custom *walk* collision remain `movement.beforeCommit` and object raycasts.
118
+ **Collision shapes are box/sphere/voxel — plus opt-in triangle meshes for raycasts and mesh-accurate walk obstruction.** Every collider in the engine — `PhysicsWorld` bodies (box `halfExtents` or sphere `radius`), object/entity picking (`scene/objectQuery` raycasts against unit boxes), and `world/voxelField`/`world/carve` blocks — is an axis-aligned box, a sphere, or a voxel cell. The one exception is opted-in catalog assets: an asset listed in `@jgengine/assets` `COLLISION_MESH_ASSET_IDS` ships a compact quantized triangle mesh in the generated index (`scene/collisionMesh` `CollisionMeshData`, extracted from the GLB at reindex — never from the rendered scene, so a headless host resolves the same shape) **plus a deterministic compound-box decomposition** (`voxelizeToBoxes` → `CollisionMeshData.boxes`, a voxel-rasterize + column-fill + greedy-merge of the model's solid volume). Collider auto-fit then (a) raycasts the actual triangles through a precomputed BVH — shots pass through a torus hole or an archway instead of hitting the fitted box; and (b) exposes the compound boxes on the fitted `mesh` `ColliderShape` (`ColliderShape.mesh.boxes`, scaled/translated onto the placement like the mesh). The `collideObjects` walk controller consumes these in `stepPlayerMovement` (host and client alike, so parity is automatic): it gathers obstacles from resolved blocking physical colliders via a bounded `object.inBox` broadphase (reach ≥ radius + max half-extent, so a wide wall's full span blocks, not a phantom 1 m box), carries each collider's real `halfExtents`/`offset` — or, for a mesh collider, the compound sub-boxes — yaw-rotated onto the obstacle, and slides the capsule against **each** sub-box (`resolveObstacleStep`), so a capsule walks THROUGH an archway opening and is stopped by its pillars/lintel/sill. `PhysicsWorld` and overlap tests still see the conservative fitted AABB; objects whose colliders don't block stop obstructing, and non-opted assets keep the fitted box everywhere. Objects with no index `dims` are not stuck with the default unit box either: the shell measures what `renderObject`/dims-less models actually mount and reports it through `ctx.scene.object.reportBounds`, so a custom-rendered prop obstructs (and raycasts) as its real rendered footprint; only objects with nothing measurable keep the default box. The seams for custom *walk* collision remain `movement.beforeCommit` and object raycasts.
119
119
 
120
120
  **Ballistic collision sweep (`physics/ballisticSweep`).** `createBallisticSweep(world, { step?, radius? })` → `BallisticSweep`, a `(origin, velocity, gravity, maxTime) => BallisticSweepHit | null` function that marches the closed-form arc (constant gravity, straight lateral) through a `PhysicsWorld` and reports the first sample inside any live body's AABB (sleeping bodies included), refined by one bisection step; `null` means the whole arc is clear. `step` (default 1/60) is the march interval in seconds, `radius` (default 0) inflates every body's AABB before the point test — pass the projectile's own radius. Wire it into `combat/projectiles` via `ProjectileSystemDeps.sweepBallistic`: when set, a ballistic shot settles at the swept impact point instead of the closed-form landing; omitted or `null` falls back to that closed-form arc.
121
121