incanto 0.71.0 → 0.73.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 (92) hide show
  1. package/bin/incanto-check.mjs +114 -42
  2. package/bin/incanto-editor.mjs +15 -9
  3. package/bin/incanto-feel.mjs +11 -1
  4. package/bin/incanto-play.mjs +11 -1
  5. package/bin/incanto-playtest.mjs +11 -1
  6. package/bin/incanto-verify.mjs +9 -2
  7. package/dist/2d.d.ts +29 -4
  8. package/dist/2d.js +3 -3
  9. package/dist/3d.d.ts +137 -15
  10. package/dist/3d.js +6 -6
  11. package/dist/{agent8-Cfmd3ar_.js → agent8-CHTT4unP.js} +1 -1
  12. package/dist/{audio-player-L8yccdMP.d.ts → audio-player-BOrk4eQx.d.ts} +1 -1
  13. package/dist/{behavior-Dcz0fr1S.d.ts → behavior-J1cmVah0.d.ts} +9 -1
  14. package/dist/{create-game-LCHBLfA4.js → create-game-CAu-ucHg.js} +8 -7
  15. package/dist/{create-game-CH4kt78v.js → create-game-CbTLFjis.js} +37 -13
  16. package/dist/debug.d.ts +1 -1
  17. package/dist/debug.js +1 -1
  18. package/dist/editor.js +1036 -930
  19. package/dist/{environment-presets-99BzP_L-.js → environment-presets-BsFJM3v0.js} +277 -60
  20. package/dist/{gameplay-CNULJvwh.js → gameplay-CRte0OVf.js} +589 -35
  21. package/dist/gameplay.d.ts +136 -4
  22. package/dist/gameplay.js +2 -2
  23. package/dist/index.d.ts +6 -4
  24. package/dist/index.js +6 -6
  25. package/dist/{loader-8-IHvbKD.d.ts → loader-BAeWMYfF.d.ts} +10 -3
  26. package/dist/net.d.ts +2 -2
  27. package/dist/net.js +2 -2
  28. package/dist/{physics-2d-FhrXUc6B.js → physics-2d-CovokK7s.js} +94 -11
  29. package/dist/{physics-3d-CFEGxBXZ.js → physics-3d-BiK6Emwn.js} +202 -15
  30. package/dist/{picking-DVo7fI13.js → picking-Dtd8JInh.js} +2 -2
  31. package/dist/react.d.ts +1 -1
  32. package/dist/react.js +1 -1
  33. package/dist/{register-BYQCBySi.js → register-CY9QCCZs.js} +45 -9
  34. package/dist/{register-DuVdzxbq.js → register-CjociOtt.js} +19 -4
  35. package/dist/{replay-DEvp3kyV.js → replay-B6BbgGM_.js} +55 -12
  36. package/dist/{replay-F7IZHdFR.d.ts → replay-wZK5Ok5c.d.ts} +2 -2
  37. package/dist/{save-slots-Bvuh2p_r.js → save-slots-CEUGeLuB.js} +57 -3
  38. package/dist/{split-screen-eULetcg-.js → split-screen-BxZ5rBe7.js} +4 -4
  39. package/dist/{split-screen-CIYf1zSf.d.ts → split-screen-D6sx8z3Z.d.ts} +2 -2
  40. package/dist/{sprite-animation-CqR2o3SA.js → sprite-animation-Bz3DHD_4.js} +1 -1
  41. package/dist/{src-_jk0qLsS.js → src-D-dnVrFY.js} +1 -1
  42. package/dist/{test-CmN54kWv.js → test-DZmCFz0Q.js} +162 -30
  43. package/dist/test.d.ts +56 -5
  44. package/dist/test.js +2 -2
  45. package/dist/{touch-BnCyPA0G.js → touch-CioTZB-y.js} +1 -1
  46. package/dist/vite.d.ts +8 -1
  47. package/dist/vite.js +22 -5
  48. package/editor/assets/{agent8-yLIEYHbd.js → agent8-GuZ5u5bi.js} +1 -1
  49. package/editor/assets/{debug-u31w_yhq.js → debug-BbxionO2.js} +1 -1
  50. package/editor/assets/{index-DK9xMGpW.js → index-CNlTzQbm.js} +92 -92
  51. package/editor/index.html +1 -1
  52. package/package.json +1 -1
  53. package/schemas/scene.schema.json +634 -10
  54. package/skills/incanto-3d-character.md +113 -5
  55. package/skills/incanto-assets.md +9 -3
  56. package/skills/incanto-behaviors-and-scripts.md +26 -2
  57. package/skills/incanto-building-2d-games.md +15 -0
  58. package/skills/incanto-building-3d-games.md +45 -0
  59. package/skills/incanto-editor.md +10 -1
  60. package/skills/incanto-environment.md +7 -2
  61. package/skills/incanto-game-feel.md +16 -11
  62. package/skills/incanto-gameplay-behaviors.md +174 -15
  63. package/skills/incanto-node-reference.md +122 -45
  64. package/skills/incanto-physics-and-input.md +67 -5
  65. package/skills/incanto-scene-json-authoring.md +37 -1
  66. package/skills/incanto-verifying-your-game.md +19 -2
  67. package/templates-app/beacon-isle-3d/PROJECT/Status.md +8 -0
  68. package/templates-app/beacon-isle-3d/PROJECT/Structure.md +3 -0
  69. package/templates-app/beacon-isle-3d/package.json +1 -1
  70. package/templates-app/beacon-isle-3d/src/game.scene.json +512 -184
  71. package/templates-app/beacon-isle-3d/verify.ts +144 -0
  72. package/templates-app/molehill-2d/package.json +1 -1
  73. package/templates-app/platformer-2d/PROJECT/Status.md +7 -0
  74. package/templates-app/platformer-2d/PROJECT/Structure.md +3 -0
  75. package/templates-app/platformer-2d/package.json +1 -1
  76. package/templates-app/platformer-2d/src/game.scene.json +319 -93
  77. package/templates-app/platformer-2d/verify.ts +54 -0
  78. package/templates-app/star-survivor/package.json +1 -1
  79. package/templates-app/star-survivor/src/game.scene.json +18 -9
  80. package/templates-app/tps-3d/PROJECT/Context.md +1 -1
  81. package/templates-app/tps-3d/PROJECT/Status.md +40 -1
  82. package/templates-app/tps-3d/PROJECT/Structure.md +19 -0
  83. package/templates-app/tps-3d/package.json +1 -1
  84. package/templates-app/tps-3d/src/behaviors.ts +9 -0
  85. package/templates-app/tps-3d/src/cover.scene.json +26 -0
  86. package/templates-app/tps-3d/src/game.scene.json +379 -80
  87. package/templates-app/tps-3d/src/main.ts +14 -0
  88. package/templates-app/tps-3d/src/pillar.scene.json +25 -0
  89. package/templates-app/tps-3d/verify.ts +582 -3
  90. package/templates-app/village-quest-3d/package.json +1 -1
  91. package/templates-app/village-quest-3d/src/grove.scene.json +98 -46
  92. package/templates-app/village-quest-3d/src/village.scene.json +449 -223
package/dist/3d.js CHANGED
@@ -1,12 +1,12 @@
1
- import { C as sunDirectionFromSky, S as sunDirectionFromElevationAzimuth, b as horizonColorFromSky, x as parseEnvironment3D } from "./save-slots-Bvuh2p_r.js";
1
+ import { C as sunDirectionFromSky, S as sunDirectionFromElevationAzimuth, b as horizonColorFromSky, x as parseEnvironment3D } from "./save-slots-CEUGeLuB.js";
2
2
  import { t as showBootFailure } from "./boot-failure-CKYrEcGF.js";
3
3
  import { t as isWebGLAvailable } from "./webgl-unavailable-C8aDbGmR.js";
4
4
  import { a as frameSignature, n as diffSignatures, o as frameStats, r as diffText, s as frameText, t as SIGNATURE_GRID } from "./frame-report-D-_7YF2G.js";
5
- import { G as StaticBody3D, H as CharacterBody3D, K as Node3D, L as Water3D, R as WATER_CUTOUT_MAX, U as PhysicsBody3D, V as Area3D, W as RigidBody3D, Y as WATER_MAX_RIPPLES, z as WaterCutout3D } from "./gameplay-CNULJvwh.js";
6
- import { A as Terrain3D, B as keyboardIntensity, C as resolveFlowerDensity, D as BoneLookAt3D, E as Camera3D, F as InstancedMesh3D, G as acquireTexture, H as rigPose, I as MeshInstance3D, M as TERRAIN_THEMES, N as terrainThemeLayers, O as BoneAttachment3D, P as Joint3D, R as QUARTER_PITCH, S as Flowers3D, T as CharacterController3D, U as TextureCache3D, V as movementState, W as acquireOwnTexture, _ as LoftMesh3D, a as Tree3D, b as Foliage3D, c as buildRiverRings, d as riverCarveChannels, f as riverStepFor, g as ModelInstance3D, h as Particles3D, i as VoxelGrid3D, j as DEFAULT_TERRAIN_TEXTURE_BASE, k as Billboard3D, l as findRiverCoverageGaps, m as traceDownhillPath, n as registerNodes3D, o as Trail3D, p as smoothCourse, r as VOXEL_PALETTE, s as River3D, u as projectToRiver, v as DirectionalLight3D, w as FLOWER_VARIETIES, x as DENSITY_PRESETS, y as OmniLight3D, z as cameraRelative } from "./environment-presets-99BzP_L-.js";
7
- import { a as Environment3D, c as AssetStore3D, i as syncTree, o as applyQualityTier3D, r as Renderer3D, s as setEnvironment3D, t as createGame3D } from "./create-game-LCHBLfA4.js";
5
+ import { B as WATER_CUTOUT_MAX, G as PhysicsBody3D, J as Node3D, K as RigidBody3D, U as Area3D, V as WaterCutout3D, W as CharacterBody3D, Z as WATER_MAX_RIPPLES, q as StaticBody3D, z as Water3D } from "./gameplay-CRte0OVf.js";
6
+ import { A as Billboard3D, B as cameraRelative, C as Flowers3D, D as Camera3D, E as CharacterController3D, F as Joint3D, G as acquireOwnTexture, H as movementState, I as InstancedMesh3D, K as acquireTexture, L as MeshInstance3D, M as DEFAULT_TERRAIN_TEXTURE_BASE, N as TERRAIN_THEMES, O as BoneLookAt3D, P as terrainThemeLayers, S as DENSITY_PRESETS, T as FLOWER_VARIETIES, U as rigPose, V as keyboardIntensity, W as TextureCache3D, _ as LoftMesh3D, a as Tree3D, b as SpotLight3D, c as buildRiverRings, d as riverCarveChannels, f as riverStepFor, g as ModelInstance3D, h as Particles3D, i as VoxelGrid3D, j as Terrain3D, k as BoneAttachment3D, l as findRiverCoverageGaps, m as traceDownhillPath, n as registerNodes3D, o as Trail3D, p as smoothCourse, r as VOXEL_PALETTE, s as River3D, u as projectToRiver, v as DirectionalLight3D, w as resolveFlowerDensity, x as Foliage3D, y as OmniLight3D, z as QUARTER_PITCH } from "./environment-presets-BsFJM3v0.js";
7
+ import { a as Environment3D, c as AssetStore3D, i as syncTree, o as applyQualityTier3D, r as Renderer3D, s as setEnvironment3D, t as createGame3D } from "./create-game-CAu-ucHg.js";
8
8
  import { n as splatWeights, t as buildHeightmap } from "./heightmap-BYgD5Edk.js";
9
- import { n as enablePhysics3D, t as Physics3D } from "./physics-3d-CFEGxBXZ.js";
9
+ import { n as enablePhysics3D, t as Physics3D } from "./physics-3d-BiK6Emwn.js";
10
10
  //#region src/3d/model-verdict.ts
11
11
  /** Mixamo exports every bone as `mixamorigX`; the retargeter binds by that name. */
12
12
  const MIXAMO = /^mixamorig[:_]?/i;
@@ -319,4 +319,4 @@ function createNavDebugNode(nav, opts) {
319
319
  return node;
320
320
  }
321
321
  //#endregion
322
- export { Area3D, AssetStore3D, Billboard3D, BoneAttachment3D, BoneLookAt3D, Camera3D, CharacterBody3D, CharacterController3D, DEFAULT_TERRAIN_TEXTURE_BASE, DirectionalLight3D, Environment3D, DENSITY_PRESETS as FLOWER_DENSITY_PRESETS, FLOWER_VARIETIES, Flowers3D, Foliage3D, InstancedMesh3D, Joint3D, LoftMesh3D, MeshInstance3D, ModelInstance3D, Node3D, OmniLight3D, Particles3D, Physics3D, PhysicsBody3D, QUARTER_PITCH, Renderer3D, RigidBody3D, River3D, SIGNATURE_GRID, StaticBody3D, TERRAIN_THEMES, Terrain3D, TextureCache3D, Trail3D, Tree3D, VOXEL_PALETTE, VoxelGrid3D, WATER_CUTOUT_MAX, WATER_MAX_RIPPLES, Water3D, WaterCutout3D, acquireOwnTexture, acquireTexture, applyQualityTier3D, buildHeightmap, buildRiverRings, buildTerrainNav, cameraRelative, createGame3D, createNavDebugNode, diffSignatures, diffText, enablePhysics3D, findRiverCoverageGaps, frameSignature, frameStats, frameText, horizonColorFromSky, isWebGLAvailable, keyboardIntensity, modelVerdict, movementState, parseEnvironment3D, projectToRiver, registerNodes3D, resolveFlowerDensity, rigPose, riverCarveChannels, riverStepFor, setEnvironment3D, showBootFailure, smoothCourse, splatWeights, sunDirectionFromElevationAzimuth, sunDirectionFromSky, syncTree, terrainThemeLayers, traceDownhillPath, verdictText };
322
+ export { Area3D, AssetStore3D, Billboard3D, BoneAttachment3D, BoneLookAt3D, Camera3D, CharacterBody3D, CharacterController3D, DEFAULT_TERRAIN_TEXTURE_BASE, DirectionalLight3D, Environment3D, DENSITY_PRESETS as FLOWER_DENSITY_PRESETS, FLOWER_VARIETIES, Flowers3D, Foliage3D, InstancedMesh3D, Joint3D, LoftMesh3D, MeshInstance3D, ModelInstance3D, Node3D, OmniLight3D, Particles3D, Physics3D, PhysicsBody3D, QUARTER_PITCH, Renderer3D, RigidBody3D, River3D, SIGNATURE_GRID, SpotLight3D, StaticBody3D, TERRAIN_THEMES, Terrain3D, TextureCache3D, Trail3D, Tree3D, VOXEL_PALETTE, VoxelGrid3D, WATER_CUTOUT_MAX, WATER_MAX_RIPPLES, Water3D, WaterCutout3D, acquireOwnTexture, acquireTexture, applyQualityTier3D, buildHeightmap, buildRiverRings, buildTerrainNav, cameraRelative, createGame3D, createNavDebugNode, diffSignatures, diffText, enablePhysics3D, findRiverCoverageGaps, frameSignature, frameStats, frameText, horizonColorFromSky, isWebGLAvailable, keyboardIntensity, modelVerdict, movementState, parseEnvironment3D, projectToRiver, registerNodes3D, resolveFlowerDensity, rigPose, riverCarveChannels, riverStepFor, setEnvironment3D, showBootFailure, smoothCourse, splatWeights, sunDirectionFromElevationAzimuth, sunDirectionFromSky, syncTree, terrainThemeLayers, traceDownhillPath, verdictText };
@@ -1,5 +1,5 @@
1
1
  import { o as __exportAll } from "./json-CfTjpvW8.js";
2
- import { Y as diagnose } from "./save-slots-Bvuh2p_r.js";
2
+ import { Y as diagnose } from "./save-slots-CEUGeLuB.js";
3
3
  //#region src/net/agent8.ts
4
4
  var agent8_exports = /* @__PURE__ */ __exportAll({
5
5
  Agent8TransportForTest: () => Agent8Transport,
@@ -1,4 +1,4 @@
1
- import { d as PropSchema, dt as Listener, jt as Node } from "./behavior-Dcz0fr1S.js";
1
+ import { d as PropSchema, dt as Listener, jt as Node } from "./behavior-J1cmVah0.js";
2
2
  import { t as Rng } from "./rng-Bb-IutXB.js";
3
3
 
4
4
  //#region src/core/boot-failure.d.ts
@@ -1103,6 +1103,12 @@ declare class EffectLog {
1103
1103
  recent(limit?: number): EffectEvent[];
1104
1104
  /** How many times an effect with this name fired (`explosion`, `#ff0000`). */
1105
1105
  countOf(name: string): number;
1106
+ /**
1107
+ * How many effects of this KIND fired (`shake`, `hitstop`, `burst`, `sfx`).
1108
+ * A shake has no name, so `countOf('shake')` answered 0 for a boss whose
1109
+ * every slam shook the camera — the harness that asked reached for the kind.
1110
+ */
1111
+ countKind(kind: string): number;
1106
1112
  /** How many effects this node fired — the question a wiring check has. */
1107
1113
  countFrom(path: string): number;
1108
1114
  /** Forget what has fired so far (between scenes, or between assertions). */
@@ -2297,7 +2303,7 @@ declare class Engine {
2297
2303
  * pass it back. Without that a game using the documented sub-scenes booted
2298
2304
  * fine and threw `UNRESOLVED_INSTANCE` on its first restart.
2299
2305
  */
2300
- resolveScene?: (path: string) => SceneJson;
2306
+ resolveScene?: (path: string) => SceneJson | null | undefined;
2301
2307
  /**
2302
2308
  * How the current scene was LOADED, for the rebuilds that happen later.
2303
2309
  *
@@ -2949,6 +2955,8 @@ declare abstract class Behavior {
2949
2955
  */
2950
2956
  get physics(): PhysicsQuery | null;
2951
2957
  getNode(path: string): Node;
2958
+ /** The node's `getNodeOrNull`, for the same reason `getNode` is here. */
2959
+ getNodeOrNull(path: string): Node | null;
2952
2960
  emit(signal: string, ...args: unknown[]): void;
2953
2961
  on(signal: string, fn: SignalListener<unknown[]>, opts?: {
2954
2962
  once?: boolean;
@@ -1,15 +1,15 @@
1
1
  import { o as __exportAll } from "./json-CfTjpvW8.js";
2
- import { C as sunDirectionFromSky, Y as diagnose, b as horizonColorFromSky, h as loadScene, ot as registerBehavior, x as parseEnvironment3D } from "./save-slots-Bvuh2p_r.js";
3
- import { C as qualityRendering, S as qualityEnvironment, _ as AudioPlayer, v as Engine, x as qualityCaps } from "./register-DuVdzxbq.js";
2
+ import { C as sunDirectionFromSky, R as sceneDimension, Y as diagnose, b as horizonColorFromSky, h as loadScene, ot as registerBehavior, x as parseEnvironment3D } from "./save-slots-CEUGeLuB.js";
3
+ import { C as qualityRendering, S as qualityEnvironment, _ as AudioPlayer, v as Engine, x as qualityCaps } from "./register-CjociOtt.js";
4
4
  import { t as IncantoError } from "./errors-BpWbnbb_.js";
5
- import { n as attachTouchControls } from "./touch-BnCyPA0G.js";
5
+ import { n as attachTouchControls } from "./touch-CioTZB-y.js";
6
6
  import { n as withWebGLContext, r as resolveRendering } from "./webgl-unavailable-C8aDbGmR.js";
7
- import { a as devServerLibrary, c as applyDriveStep, d as audioErrors, i as crossFade, l as wireDevChannel, n as teardown, o as openBundledEditor, r as pauseWhenHidden, s as poseFromRenderer, t as nodeFromHits, u as claimCanvasGestures } from "./picking-DVo7fI13.js";
7
+ import { a as devServerLibrary, c as applyDriveStep, d as audioErrors, i as crossFade, l as wireDevChannel, n as teardown, o as openBundledEditor, r as pauseWhenHidden, s as poseFromRenderer, t as nodeFromHits, u as claimCanvasGestures } from "./picking-Dtd8JInh.js";
8
8
  import { o as frameStats } from "./frame-report-D-_7YF2G.js";
9
- import { J as createCausticsQuad, K as Node3D, U as PhysicsBody3D, n as registerGameplayBehaviors } from "./gameplay-CNULJvwh.js";
9
+ import { G as PhysicsBody3D, J as Node3D, X as createCausticsQuad, n as registerGameplayBehaviors } from "./gameplay-CRte0OVf.js";
10
10
  import { t as debugSources } from "./debug-draw-BM3DsvtT.js";
11
- import { E as Camera3D, U as TextureCache3D, g as ModelInstance3D, n as registerNodes3D, t as resolveEnvironmentHdri, v as DirectionalLight3D } from "./environment-presets-99BzP_L-.js";
12
- import { n as enablePhysics3D } from "./physics-3d-CFEGxBXZ.js";
11
+ import { D as Camera3D, W as TextureCache3D, g as ModelInstance3D, n as registerNodes3D, t as resolveEnvironmentHdri, v as DirectionalLight3D } from "./environment-presets-BsFJM3v0.js";
12
+ import { n as enablePhysics3D } from "./physics-3d-BiK6Emwn.js";
13
13
  import { ACESFilmicToneMapping, AmbientLight, Box3, BufferAttribute, BufferGeometry, Color, DepthTexture, EquirectangularReflectionMapping, FloatType, Fog, HalfFloatType, LineBasicMaterial, LineSegments, LoadingManager, Matrix4, Mesh, PCFShadowMap, PMREMGenerator, PerspectiveCamera, PlaneGeometry, Quaternion, Raycaster, Scene, ShaderMaterial, Vector2, Vector3, WebGLRenderTarget, WebGLRenderer } from "three";
14
14
  import { VRMLoaderPlugin, VRMUtils } from "@pixiv/three-vrm";
15
15
  import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
@@ -2253,6 +2253,7 @@ async function createGame3D(opts) {
2253
2253
  ...opts._scheduler ? { scheduler: opts._scheduler } : {}
2254
2254
  });
2255
2255
  const sourceJson = cloneSceneJson(opts.scene);
2256
+ if (sceneDimension(sourceJson) === "2d") throw new IncantoError("WRONG_DIMENSION", `createGame3D was given a 2D scene ('${String(sourceJson.name ?? "scene")}'). Its nodes are never drawn by the 3D renderer and never simulated by 3D physics — you get a blank canvas. Boot it with createGame2D instead.`);
2256
2257
  const scene = loadScene(cloneSceneJson(sourceJson), {
2257
2258
  resolveScene: opts.resolveScene,
2258
2259
  engine
@@ -1,15 +1,15 @@
1
1
  import { o as __exportAll } from "./json-CfTjpvW8.js";
2
- import { D as computeViewport, O as resolveViewport, Y as diagnose, h as loadScene, ot as registerBehavior } from "./save-slots-Bvuh2p_r.js";
3
- import { C as qualityRendering, _ as AudioPlayer, v as Engine } from "./register-DuVdzxbq.js";
2
+ import { D as computeViewport, O as resolveViewport, R as sceneDimension, Y as diagnose, h as loadScene, ot as registerBehavior } from "./save-slots-CEUGeLuB.js";
3
+ import { C as qualityRendering, _ as AudioPlayer, v as Engine } from "./register-CjociOtt.js";
4
4
  import { t as IncantoError } from "./errors-BpWbnbb_.js";
5
- import { n as attachTouchControls } from "./touch-BnCyPA0G.js";
5
+ import { n as attachTouchControls } from "./touch-CioTZB-y.js";
6
6
  import { n as withWebGLContext, r as resolveRendering } from "./webgl-unavailable-C8aDbGmR.js";
7
- import { a as devServerLibrary, c as applyDriveStep, d as audioErrors, i as crossFade, l as wireDevChannel, n as teardown, o as openBundledEditor, r as pauseWhenHidden, t as nodeFromHits, u as claimCanvasGestures } from "./picking-DVo7fI13.js";
7
+ import { a as devServerLibrary, c as applyDriveStep, d as audioErrors, i as crossFade, l as wireDevChannel, n as teardown, o as openBundledEditor, r as pauseWhenHidden, t as nodeFromHits, u as claimCanvasGestures } from "./picking-Dtd8JInh.js";
8
8
  import { o as frameStats } from "./frame-report-D-_7YF2G.js";
9
- import { n as registerGameplayBehaviors } from "./gameplay-CNULJvwh.js";
10
- import { g as PhysicsBody2D, n as UILayer, t as registerNodes2D, u as Camera2D, y as Node2D } from "./register-BYQCBySi.js";
9
+ import { n as registerGameplayBehaviors } from "./gameplay-CRte0OVf.js";
10
+ import { g as PhysicsBody2D, n as UILayer, t as registerNodes2D, u as Camera2D, y as Node2D } from "./register-CY9QCCZs.js";
11
11
  import { t as debugSources } from "./debug-draw-BM3DsvtT.js";
12
- import { n as enablePhysics2D } from "./physics-2d-FhrXUc6B.js";
12
+ import { n as enablePhysics2D } from "./physics-2d-CovokK7s.js";
13
13
  import { Box3, BufferAttribute, BufferGeometry, Color, LineBasicMaterial, LineSegments, LinearFilter, NearestFilter, OrthographicCamera, Raycaster, SRGBColorSpace, Scene, TextureLoader, Vector2, Vector3, WebGLRenderer } from "three";
14
14
  //#region src/2d/assets.ts
15
15
  /**
@@ -132,6 +132,34 @@ var AssetStore2D = class {
132
132
  }
133
133
  };
134
134
  //#endregion
135
+ //#region src/2d/debug-lines.ts
136
+ /**
137
+ * Physics debug segments, moved into the space the 2D renderer draws in.
138
+ *
139
+ * Two coordinate systems meet here and they disagree about Y. Engine 2D is
140
+ * y-DOWN (screen pixels, gravity `+980`, and Rapier's world is built the same
141
+ * way — `kcc.setUp({x: 0, y: -1})`). The three.js scene the renderer paints
142
+ * into is y-UP, which is why every node's own sync writes
143
+ * `o.position.set(x, -y, 0)`.
144
+ *
145
+ * `syncDebugLines` copied Rapier's vertices straight across without that
146
+ * negation, so every collider outline was MIRRORED about the world's y=0 line:
147
+ * a crate at y=120 drew its box at −120, the further from the axis the further
148
+ * off, and a tilemap's merged floor at y=384 drew itself off the top of the
149
+ * canvas entirely. The overlay whose whole promise is "the colliders the
150
+ * ENGINE builds… wherever physics actually puts them" was the one thing in the
151
+ * 2D view that was not where physics put it.
152
+ */
153
+ function debugLinesToScene(px) {
154
+ const xyz = new Float32Array(px.length / 2 * 3);
155
+ for (let i = 0, j = 0; i < px.length; i += 2, j += 3) {
156
+ xyz[j] = px[i];
157
+ xyz[j + 1] = -px[i + 1];
158
+ xyz[j + 2] = 0;
159
+ }
160
+ return xyz;
161
+ }
162
+ //#endregion
135
163
  //#region src/2d/picking.ts
136
164
  function screenFromWorld(view, wx, wy) {
137
165
  return {
@@ -547,12 +575,7 @@ var Renderer2D = class {
547
575
  }
548
576
  this.debugLines.visible = vertices !== null;
549
577
  if (!vertices) return;
550
- const xyz = new Float32Array(vertices.length / 2 * 3);
551
- for (let i = 0, j = 0; i < vertices.length; i += 2, j += 3) {
552
- xyz[j] = vertices[i];
553
- xyz[j + 1] = vertices[i + 1];
554
- xyz[j + 2] = 0;
555
- }
578
+ const xyz = debugLinesToScene(vertices);
556
579
  this.debugLines.geometry.setAttribute("position", new BufferAttribute(xyz, 3));
557
580
  }
558
581
  render() {
@@ -809,6 +832,7 @@ async function createGame2D(opts) {
809
832
  ...opts._scheduler ? { scheduler: opts._scheduler } : {}
810
833
  });
811
834
  const sourceJson = cloneSceneJson(opts.scene);
835
+ if (sceneDimension(sourceJson) === "3d") throw new IncantoError("WRONG_DIMENSION", `createGame2D was given a 3D scene ('${String(sourceJson.name ?? "scene")}'). Its nodes are never drawn by the 2D renderer and never simulated by 2D physics — you get a blank canvas. Boot it with createGame3D instead.`);
812
836
  const scene = loadScene(cloneSceneJson(sourceJson), {
813
837
  resolveScene: opts.resolveScene,
814
838
  engine
package/dist/debug.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Ft as LogLevel, T as RendererStats, b as Engine } from "./behavior-Dcz0fr1S.js";
1
+ import { Ft as LogLevel, T as RendererStats, b as Engine } from "./behavior-J1cmVah0.js";
2
2
 
3
3
  //#region src/debug/panel.d.ts
4
4
  /** Minimal document surface the overlay needs (injectable for tests). */
package/dist/debug.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as jsonClone } from "./json-CfTjpvW8.js";
2
- import { d as mergeStaticProps, r as capturePointer } from "./touch-BnCyPA0G.js";
2
+ import { d as mergeStaticProps, r as capturePointer } from "./touch-CioTZB-y.js";
3
3
  import { t as debugSources } from "./debug-draw-BM3DsvtT.js";
4
4
  //#region src/debug/capture.ts
5
5
  /**