@zylem/behaviors 0.5.2 → 0.5.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.
Files changed (165) hide show
  1. package/dist/{behavior-system-CldqNUgr.d.ts → behavior-system-HEt67el5.d.ts} +14 -1
  2. package/dist/{chunk-EIWQM6U3.js → chunk-2HKY6WF7.js} +0 -1
  3. package/dist/{chunk-IZJFUAXB.js → chunk-2HLZBWGD.js} +0 -1
  4. package/dist/{chunk-LL4FLHIY.js → chunk-2YF7J3H4.js} +0 -1
  5. package/dist/{chunk-SGHIGTVZ.js → chunk-3X3CL24Z.js} +0 -1
  6. package/dist/{chunk-HZMY3TT4.js → chunk-4DVDFCVY.js} +0 -1
  7. package/dist/{chunk-QVCMJ4Q2.js → chunk-4EWASZHB.js} +0 -1
  8. package/dist/{chunk-4LLK2FJI.js → chunk-55CFXXZH.js} +3 -4
  9. package/dist/{chunk-4MZ57HPD.js → chunk-57GLKGEX.js} +3 -4
  10. package/dist/{chunk-QS3VXWVO.js → chunk-7GGR26YA.js} +3 -4
  11. package/dist/{chunk-Y4PHT2HG.js → chunk-7LHXAEOZ.js} +4 -5
  12. package/dist/{chunk-PLIXVF7B.js → chunk-7TIIRJKF.js} +3 -4
  13. package/dist/{chunk-LZIHSJZR.js → chunk-CB3C7CRD.js} +4 -5
  14. package/dist/{chunk-G2KUXVU6.js → chunk-CTSYM56P.js} +30 -12
  15. package/dist/{chunk-2PAHQZZD.js → chunk-CVRN7YAI.js} +3 -4
  16. package/dist/{chunk-NW4SE5XW.js → chunk-DD4U42FG.js} +2 -3
  17. package/dist/{chunk-BAXJ7XHJ.js → chunk-E2MOFIDH.js} +3 -4
  18. package/dist/{chunk-WOMHL23C.js → chunk-ERS6SNA5.js} +1 -2
  19. package/dist/{chunk-4WH2ZN7P.js → chunk-F7E23E26.js} +0 -1
  20. package/dist/{chunk-DZ4LLQON.js → chunk-GZ3DQIIZ.js} +23 -2
  21. package/dist/{chunk-5WRI5ZAA.js → chunk-JSBRDJBE.js} +0 -1
  22. package/dist/{chunk-5A5AYP2C.js → chunk-K6CWKFHL.js} +0 -1
  23. package/dist/{chunk-52FJIDGL.js → chunk-LAN7U3AK.js} +1 -2
  24. package/dist/{chunk-WU6XXL3D.js → chunk-LLDLVVG4.js} +4 -5
  25. package/dist/{chunk-M3QDKKDF.js → chunk-LWM346FW.js} +0 -1
  26. package/dist/{chunk-7DGXUAPV.js → chunk-M25QJBDN.js} +4 -5
  27. package/dist/{chunk-7JLWZXPA.js → chunk-NDJO56BB.js} +3 -4
  28. package/dist/{chunk-AS3HR7AS.js → chunk-OBF6BIA2.js} +1 -2
  29. package/dist/{chunk-KIYUUSPK.js → chunk-OSPQFWQF.js} +2 -3
  30. package/dist/{chunk-4CEW64HO.js → chunk-OU2SW4U5.js} +3 -4
  31. package/dist/{chunk-H4TJ7X4O.js → chunk-QU6GQ657.js} +2 -3
  32. package/dist/{chunk-KFFETUAL.js → chunk-RR3XNDKG.js} +2 -3
  33. package/dist/{chunk-JVADRLWX.js → chunk-SHZZ2QRV.js} +2 -3
  34. package/dist/{chunk-7W3KY55G.js → chunk-TK3AXXXI.js} +3 -4
  35. package/dist/{chunk-OPZ2LVS2.js → chunk-TZQQYJYK.js} +0 -1
  36. package/dist/{chunk-7JJEIADR.js → chunk-UF7QPYUX.js} +299 -157
  37. package/dist/{chunk-NQPYMUDF.js → chunk-UKGBQTHL.js} +3 -4
  38. package/dist/{chunk-5XPPLTC7.js → chunk-UUMH3DC3.js} +1 -2
  39. package/dist/{chunk-TBUKJKY6.js → chunk-VJ3UA6OD.js} +1 -2
  40. package/dist/{chunk-OHCPV2NT.js → chunk-WHKPWIQO.js} +0 -1
  41. package/dist/{chunk-EZNCCO4L.js → chunk-YDLO5M7S.js} +0 -1
  42. package/dist/{components-BmievOxF.d.ts → components-JZQoO2sU.d.ts} +1 -1
  43. package/dist/cooldown.d.ts +1 -1
  44. package/dist/cooldown.js +3 -4
  45. package/dist/coordinators/boundary-ricochet-3d.d.ts +2 -2
  46. package/dist/coordinators/boundary-ricochet-3d.js +4 -5
  47. package/dist/coordinators/boundary-ricochet.d.ts +2 -2
  48. package/dist/coordinators/boundary-ricochet.js +4 -5
  49. package/dist/coordinators/first-person-shooter.js +4 -5
  50. package/dist/coordinators/multidirectional-space-shooter.d.ts +1 -1
  51. package/dist/coordinators/multidirectional-space-shooter.js +6 -7
  52. package/dist/coordinators/top-down-shooter.d.ts +1 -1
  53. package/dist/coordinators/top-down-shooter.js +6 -7
  54. package/dist/core.d.ts +21 -6
  55. package/dist/core.js +29 -7
  56. package/dist/destructible-3d.d.ts +1 -1
  57. package/dist/destructible-3d.js +4 -5
  58. package/dist/destructible-prebake.js +2 -3
  59. package/dist/{first-person-perspective-C9Mptl0-.d.ts → first-person-perspective-BxFHgFln.d.ts} +2 -0
  60. package/dist/first-person.d.ts +12 -3
  61. package/dist/first-person.js +7 -8
  62. package/dist/index.d.ts +5 -5
  63. package/dist/index.js +40 -41
  64. package/dist/jumper-2d.d.ts +1 -1
  65. package/dist/jumper-2d.js +5 -6
  66. package/dist/jumper-3d.d.ts +1 -1
  67. package/dist/jumper-3d.js +6 -7
  68. package/dist/{moveable-rdIvWiak.d.ts → moveable-BdFmI3s1.d.ts} +1 -1
  69. package/dist/particle-emitter/presets.d.ts +1 -1
  70. package/dist/particle-emitter/presets.js +2 -3
  71. package/dist/particle-emitter.d.ts +3 -3
  72. package/dist/particle-emitter.js +5 -6
  73. package/dist/platformer-2d.d.ts +1 -1
  74. package/dist/platformer-2d.js +5 -6
  75. package/dist/platformer-3d.d.ts +1 -1
  76. package/dist/platformer-3d.js +5 -6
  77. package/dist/ricochet-2d.d.ts +1 -1
  78. package/dist/ricochet-2d.js +5 -6
  79. package/dist/ricochet-3d.d.ts +1 -1
  80. package/dist/ricochet-3d.js +5 -6
  81. package/dist/runtime-2d.d.ts +1 -1
  82. package/dist/runtime-2d.js +2 -3
  83. package/dist/screen-visibility.d.ts +1 -1
  84. package/dist/screen-visibility.js +3 -4
  85. package/dist/screen-wrap.d.ts +1 -1
  86. package/dist/screen-wrap.js +5 -6
  87. package/dist/shooter-2d.d.ts +1 -1
  88. package/dist/shooter-2d.js +5 -6
  89. package/dist/{spark-Dx3cJbTW.d.ts → spark-C4Tp-52_.d.ts} +4 -2
  90. package/dist/thruster.d.ts +1 -1
  91. package/dist/thruster.js +5 -6
  92. package/dist/top-down-movement.d.ts +1 -1
  93. package/dist/top-down-movement.js +7 -8
  94. package/dist/world-boundary-2d.d.ts +1 -1
  95. package/dist/world-boundary-2d.js +6 -7
  96. package/dist/world-boundary-3d.d.ts +1 -1
  97. package/dist/world-boundary-3d.js +6 -7
  98. package/package.json +159 -161
  99. package/dist/chunk-2PAHQZZD.js.map +0 -1
  100. package/dist/chunk-4CEW64HO.js.map +0 -1
  101. package/dist/chunk-4LLK2FJI.js.map +0 -1
  102. package/dist/chunk-4MZ57HPD.js.map +0 -1
  103. package/dist/chunk-4WH2ZN7P.js.map +0 -1
  104. package/dist/chunk-52FJIDGL.js.map +0 -1
  105. package/dist/chunk-5A5AYP2C.js.map +0 -1
  106. package/dist/chunk-5WRI5ZAA.js.map +0 -1
  107. package/dist/chunk-5XPPLTC7.js.map +0 -1
  108. package/dist/chunk-7DGXUAPV.js.map +0 -1
  109. package/dist/chunk-7JJEIADR.js.map +0 -1
  110. package/dist/chunk-7JLWZXPA.js.map +0 -1
  111. package/dist/chunk-7W3KY55G.js.map +0 -1
  112. package/dist/chunk-AS3HR7AS.js.map +0 -1
  113. package/dist/chunk-BAXJ7XHJ.js.map +0 -1
  114. package/dist/chunk-DZ4LLQON.js.map +0 -1
  115. package/dist/chunk-EIWQM6U3.js.map +0 -1
  116. package/dist/chunk-EZNCCO4L.js.map +0 -1
  117. package/dist/chunk-G2KUXVU6.js.map +0 -1
  118. package/dist/chunk-H4TJ7X4O.js.map +0 -1
  119. package/dist/chunk-HZMY3TT4.js.map +0 -1
  120. package/dist/chunk-IZJFUAXB.js.map +0 -1
  121. package/dist/chunk-JVADRLWX.js.map +0 -1
  122. package/dist/chunk-KFFETUAL.js.map +0 -1
  123. package/dist/chunk-KIYUUSPK.js.map +0 -1
  124. package/dist/chunk-LL4FLHIY.js.map +0 -1
  125. package/dist/chunk-LZIHSJZR.js.map +0 -1
  126. package/dist/chunk-M3QDKKDF.js.map +0 -1
  127. package/dist/chunk-NQPYMUDF.js.map +0 -1
  128. package/dist/chunk-NW4SE5XW.js.map +0 -1
  129. package/dist/chunk-OHCPV2NT.js.map +0 -1
  130. package/dist/chunk-OPZ2LVS2.js.map +0 -1
  131. package/dist/chunk-PLIXVF7B.js.map +0 -1
  132. package/dist/chunk-QS3VXWVO.js.map +0 -1
  133. package/dist/chunk-QVCMJ4Q2.js.map +0 -1
  134. package/dist/chunk-SGHIGTVZ.js.map +0 -1
  135. package/dist/chunk-TBUKJKY6.js.map +0 -1
  136. package/dist/chunk-WOMHL23C.js.map +0 -1
  137. package/dist/chunk-WU6XXL3D.js.map +0 -1
  138. package/dist/chunk-Y4PHT2HG.js.map +0 -1
  139. package/dist/cooldown.js.map +0 -1
  140. package/dist/coordinators/boundary-ricochet-3d.js.map +0 -1
  141. package/dist/coordinators/boundary-ricochet.js.map +0 -1
  142. package/dist/coordinators/first-person-shooter.js.map +0 -1
  143. package/dist/coordinators/multidirectional-space-shooter.js.map +0 -1
  144. package/dist/coordinators/top-down-shooter.js.map +0 -1
  145. package/dist/core.js.map +0 -1
  146. package/dist/destructible-3d.js.map +0 -1
  147. package/dist/destructible-prebake.js.map +0 -1
  148. package/dist/first-person.js.map +0 -1
  149. package/dist/index.js.map +0 -1
  150. package/dist/jumper-2d.js.map +0 -1
  151. package/dist/jumper-3d.js.map +0 -1
  152. package/dist/particle-emitter/presets.js.map +0 -1
  153. package/dist/particle-emitter.js.map +0 -1
  154. package/dist/platformer-2d.js.map +0 -1
  155. package/dist/platformer-3d.js.map +0 -1
  156. package/dist/ricochet-2d.js.map +0 -1
  157. package/dist/ricochet-3d.js.map +0 -1
  158. package/dist/runtime-2d.js.map +0 -1
  159. package/dist/screen-visibility.js.map +0 -1
  160. package/dist/screen-wrap.js.map +0 -1
  161. package/dist/shooter-2d.js.map +0 -1
  162. package/dist/thruster.js.map +0 -1
  163. package/dist/top-down-movement.js.map +0 -1
  164. package/dist/world-boundary-2d.js.map +0 -1
  165. package/dist/world-boundary-3d.js.map +0 -1
@@ -542,13 +542,16 @@ interface StageEvent {
542
542
  * Mirrors the `STAGE_RENDER_STRIDE` (12-float) packing documented in
543
543
  * `runtime/stage/render.rs`:
544
544
  * `[0..3]` position, `[3..7]` rotation xyzw, `[7]` uniform scale,
545
- * `[8..12]` custom0..custom3 (per-behavior shading hints).
545
+ * `[8..11]` custom0..custom2 (shading hints), `[11]` custom3 sleeping flag
546
+ * (1.0 = sleeping).
546
547
  */
547
548
  interface StageRenderSlot {
548
549
  position: [number, number, number];
549
550
  rotation: [number, number, number, number];
550
551
  scale: number;
551
552
  custom: [number, number, number, number];
553
+ /** True when custom[3] indicates the body is sleeping. */
554
+ isSleeping: boolean;
552
555
  }
553
556
  /**
554
557
  * Read a single entity slot out of a unified-Stage render buffer view.
@@ -666,6 +669,16 @@ declare class WasmStageRuntime implements BehaviorRuntime {
666
669
  * fraction of `step()`.
667
670
  */
668
671
  setEventsEnabled(enabled: boolean): void;
672
+ /** Cap Rapier contact solver iterations (default 4). */
673
+ setSolverIterations(iterations: number): void;
674
+ /**
675
+ * Override sleep activation thresholds for sleep-capable dynamic bodies.
676
+ * Higher velocity thresholds / lower `timeUntilSleep` put piles to sleep
677
+ * sooner.
678
+ */
679
+ setSleepThresholds(normalizedLinearThreshold: number, angularThreshold: number, timeUntilSleep: number): void;
680
+ /** Number of awake (non-sleeping) dynamic rigid bodies. */
681
+ awakeDynamicCount(): number;
669
682
  createEntity(): number;
670
683
  destroyEntity(slot: number): boolean;
671
684
  attachBody(slot: number, config: StageBodyConfig): boolean;
@@ -24,4 +24,3 @@ export {
24
24
  createTopDownMovementInputComponent,
25
25
  createTopDownMovementStateComponent
26
26
  };
27
- //# sourceMappingURL=chunk-EIWQM6U3.js.map
@@ -27,4 +27,3 @@ export {
27
27
  createThrusterInputComponent,
28
28
  createThrusterStateComponent
29
29
  };
30
- //# sourceMappingURL=chunk-IZJFUAXB.js.map
@@ -9,4 +9,3 @@ function updateBoundaryRicochet(update) {
9
9
  export {
10
10
  updateBoundaryRicochet
11
11
  };
12
- //# sourceMappingURL=chunk-LL4FLHIY.js.map
@@ -47,4 +47,3 @@ export {
47
47
  rotateLocalOffset2D,
48
48
  getRotationAngle2D
49
49
  };
50
- //# sourceMappingURL=chunk-SGHIGTVZ.js.map
@@ -241,4 +241,3 @@ export {
241
241
  plainWorkerResultToTemplateParts,
242
242
  destructibleFragmentsToPlainResponse
243
243
  };
244
- //# sourceMappingURL=chunk-HZMY3TT4.js.map
@@ -29,4 +29,3 @@ export {
29
29
  createFirstPersonInputComponent,
30
30
  createFirstPersonStateComponent
31
31
  };
32
- //# sourceMappingURL=chunk-QVCMJ4Q2.js.map
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  SyncStateMachine,
3
3
  import_typescript_fsm
4
- } from "./chunk-AS3HR7AS.js";
4
+ } from "./chunk-OBF6BIA2.js";
5
5
  import {
6
6
  STAGE_INPUT_BUTTON_JUMP,
7
7
  STAGE_INPUT_BUTTON_RUN,
8
8
  StagePlatformerShapeSource,
9
9
  readBehaviorSnapshot
10
- } from "./chunk-DZ4LLQON.js";
10
+ } from "./chunk-GZ3DQIIZ.js";
11
11
  import {
12
12
  defineBehavior
13
- } from "./chunk-EZNCCO4L.js";
13
+ } from "./chunk-YDLO5M7S.js";
14
14
 
15
15
  // src/lib/behaviors/platformer-3d/components.ts
16
16
  function createPlatformer3DMovementComponent(options = {}) {
@@ -341,4 +341,3 @@ export {
341
341
  Platformer3DFSM,
342
342
  Platformer3DBehavior
343
343
  };
344
- //# sourceMappingURL=chunk-4LLK2FJI.js.map
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  SyncStateMachine,
3
3
  import_typescript_fsm
4
- } from "./chunk-AS3HR7AS.js";
4
+ } from "./chunk-OBF6BIA2.js";
5
5
  import {
6
6
  STAGE_INPUT_BUTTON_JUMP,
7
7
  STAGE_INPUT_BUTTON_RUN,
8
8
  StagePlatformerShapeSource,
9
9
  readBehaviorSnapshot
10
- } from "./chunk-DZ4LLQON.js";
10
+ } from "./chunk-GZ3DQIIZ.js";
11
11
  import {
12
12
  defineBehavior
13
- } from "./chunk-EZNCCO4L.js";
13
+ } from "./chunk-YDLO5M7S.js";
14
14
 
15
15
  // src/lib/behaviors/platformer-2d/components.ts
16
16
  function createPlatformer2DMovementComponent(options = {}) {
@@ -320,4 +320,3 @@ export {
320
320
  Platformer2DFSM,
321
321
  Platformer2DBehavior
322
322
  };
323
- //# sourceMappingURL=chunk-4MZ57HPD.js.map
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  SyncStateMachine,
3
3
  import_typescript_fsm
4
- } from "./chunk-AS3HR7AS.js";
4
+ } from "./chunk-OBF6BIA2.js";
5
5
  import {
6
6
  StageRicochetDim,
7
7
  StageRicochetReflection
8
- } from "./chunk-DZ4LLQON.js";
8
+ } from "./chunk-GZ3DQIIZ.js";
9
9
  import {
10
10
  defineBehavior
11
- } from "./chunk-EZNCCO4L.js";
11
+ } from "./chunk-YDLO5M7S.js";
12
12
 
13
13
  // src/lib/behaviors/ricochet-3d/ricochet-3d-fsm.ts
14
14
  var Ricochet3DState = /* @__PURE__ */ ((Ricochet3DState2) => {
@@ -437,4 +437,3 @@ export {
437
437
  Ricochet3DFSM,
438
438
  Ricochet3DBehavior
439
439
  };
440
- //# sourceMappingURL=chunk-QS3VXWVO.js.map
@@ -2,16 +2,16 @@ import {
2
2
  createTopDownMovementComponent,
3
3
  createTopDownMovementInputComponent,
4
4
  createTopDownMovementStateComponent
5
- } from "./chunk-EIWQM6U3.js";
5
+ } from "./chunk-2HKY6WF7.js";
6
6
  import {
7
7
  resolveAim2D
8
- } from "./chunk-TBUKJKY6.js";
8
+ } from "./chunk-VJ3UA6OD.js";
9
9
  import {
10
10
  StageTopDownPlane
11
- } from "./chunk-DZ4LLQON.js";
11
+ } from "./chunk-GZ3DQIIZ.js";
12
12
  import {
13
13
  defineBehavior
14
- } from "./chunk-EZNCCO4L.js";
14
+ } from "./chunk-YDLO5M7S.js";
15
15
 
16
16
  // src/lib/behaviors/top-down-movement/top-down-movement.descriptor.ts
17
17
  var defaultOptions = {
@@ -95,4 +95,3 @@ var TopDownMovementBehavior = defineBehavior({
95
95
  export {
96
96
  TopDownMovementBehavior
97
97
  };
98
- //# sourceMappingURL=chunk-Y4PHT2HG.js.map
@@ -4,13 +4,13 @@ import {
4
4
  getRotationAngle2D,
5
5
  normalizeDirection2D,
6
6
  rotateLocalOffset2D
7
- } from "./chunk-SGHIGTVZ.js";
7
+ } from "./chunk-3X3CL24Z.js";
8
8
  import {
9
9
  normalizeVec3
10
- } from "./chunk-M3QDKKDF.js";
10
+ } from "./chunk-LWM346FW.js";
11
11
  import {
12
12
  defineBehavior
13
- } from "./chunk-EZNCCO4L.js";
13
+ } from "./chunk-YDLO5M7S.js";
14
14
 
15
15
  // src/lib/behaviors/shooter-2d/components.ts
16
16
  function createShooter2DStateComponent() {
@@ -159,4 +159,3 @@ export {
159
159
  createShooter2DStateComponent,
160
160
  Shooter2DBehavior
161
161
  };
162
- //# sourceMappingURL=chunk-PLIXVF7B.js.map
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  createJumpInput3D
3
- } from "./chunk-4WH2ZN7P.js";
3
+ } from "./chunk-F7E23E26.js";
4
4
  import {
5
5
  SyncStateMachine,
6
6
  import_typescript_fsm
7
- } from "./chunk-AS3HR7AS.js";
7
+ } from "./chunk-OBF6BIA2.js";
8
8
  import {
9
9
  STAGE_INPUT_BUTTON_JUMP,
10
10
  readBehaviorSnapshot
11
- } from "./chunk-DZ4LLQON.js";
11
+ } from "./chunk-GZ3DQIIZ.js";
12
12
  import {
13
13
  defineBehavior
14
- } from "./chunk-EZNCCO4L.js";
14
+ } from "./chunk-YDLO5M7S.js";
15
15
 
16
16
  // src/lib/behaviors/jumper-3d/jumper-3d-fsm.ts
17
17
  var Jumper3DState = /* @__PURE__ */ ((Jumper3DState2) => {
@@ -188,4 +188,3 @@ export {
188
188
  Jumper3DFSM,
189
189
  Jumper3DBehavior
190
190
  };
191
- //# sourceMappingURL=chunk-LZIHSJZR.js.map
@@ -2,22 +2,22 @@ import {
2
2
  createFirstPersonInputComponent,
3
3
  createFirstPersonMovementComponent,
4
4
  createFirstPersonStateComponent
5
- } from "./chunk-QVCMJ4Q2.js";
5
+ } from "./chunk-4EWASZHB.js";
6
6
  import {
7
7
  VEC3_ZERO,
8
8
  toThreeVector3
9
- } from "./chunk-M3QDKKDF.js";
9
+ } from "./chunk-LWM346FW.js";
10
10
  import {
11
11
  SyncStateMachine,
12
12
  import_typescript_fsm
13
- } from "./chunk-AS3HR7AS.js";
13
+ } from "./chunk-OBF6BIA2.js";
14
14
  import {
15
15
  STAGE_INPUT_BUTTON_RUN,
16
16
  readBehaviorSnapshot
17
- } from "./chunk-DZ4LLQON.js";
17
+ } from "./chunk-GZ3DQIIZ.js";
18
18
  import {
19
19
  defineBehavior
20
- } from "./chunk-EZNCCO4L.js";
20
+ } from "./chunk-YDLO5M7S.js";
21
21
 
22
22
  // src/lib/behaviors/first-person/first-person-fsm.ts
23
23
  var FirstPersonState = /* @__PURE__ */ ((FirstPersonState2) => {
@@ -146,28 +146,45 @@ var FirstPersonPresentation = class {
146
146
  );
147
147
  }
148
148
  const vm = this.viewmodels.get(entityUuid);
149
- if (vm && perspective?.initialPosition && state) {
149
+ if (vm && state && (vm.cameraObject || perspective?.initialPosition)) {
150
150
  this.positionViewmodel(vm, perspective, state, runtime);
151
151
  }
152
152
  }
153
153
  /**
154
154
  * Position a viewmodel entity relative to the camera's eye position and rotation.
155
+ * Prefer `cameraObject` parenting for jitter-free follow during movement.
155
156
  */
156
157
  positionViewmodel(vm, perspective, state, runtime) {
158
+ const entity = vm.entity;
159
+ const group = entity?.group;
160
+ if (vm.cameraObject && group) {
161
+ if (entity) {
162
+ entity.skipRenderPoseSync = true;
163
+ }
164
+ if (group.parent !== vm.cameraObject) {
165
+ vm.cameraObject.add(group);
166
+ }
167
+ group.position.copy(vm.offset);
168
+ if (vm.rotation) {
169
+ group.rotation.copy(vm.rotation);
170
+ } else {
171
+ group.rotation.set(0, 0, 0);
172
+ }
173
+ return;
174
+ }
157
175
  const eyePos = perspective.initialPosition;
158
176
  if (!eyePos) return;
159
177
  _viewmodelQuat.setFromEuler(
160
178
  _viewmodelEuler.set(state.pitch, state.yaw, 0, "YXZ")
161
179
  );
180
+ _offset.copy(vm.offset).applyQuaternion(_viewmodelQuat);
162
181
  if (vm.rotation) {
163
182
  _viewmodelLocalQuat.setFromEuler(vm.rotation);
164
183
  _viewmodelQuat.multiply(_viewmodelLocalQuat);
165
184
  }
166
- _offset.copy(vm.offset).applyQuaternion(_viewmodelQuat);
167
185
  const wx = eyePos.x + _offset.x;
168
186
  const wy = eyePos.y + _offset.y;
169
187
  const wz = eyePos.z + _offset.z;
170
- const entity = vm.entity;
171
188
  const handle = entity?.runtimeHandle ?? -1;
172
189
  if (handle >= 0) {
173
190
  runtime.setPosition(handle, wx, wy, wz);
@@ -179,9 +196,9 @@ var FirstPersonPresentation = class {
179
196
  _viewmodelQuat.w
180
197
  );
181
198
  }
182
- if (entity?.group) {
183
- entity.group.position.set(wx, wy, wz);
184
- entity.group.quaternion.copy(_viewmodelQuat);
199
+ if (group) {
200
+ group.position.set(wx, wy, wz);
201
+ group.quaternion.copy(_viewmodelQuat);
185
202
  }
186
203
  }
187
204
  /** Cleanup */
@@ -227,6 +244,8 @@ var FirstPersonBehaviorSystem = class {
227
244
  gameEntity.firstPersonState = createFirstPersonStateComponent();
228
245
  }
229
246
  if (options.perspective && !this.presentation.hasPerspective(gameEntity.uuid)) {
247
+ const eyeHeight = options.eyeHeight ?? defaultOptions.eyeHeight;
248
+ options.perspective.setEyeHeight?.(eyeHeight);
230
249
  this.presentation.setPerspective(gameEntity.uuid, options.perspective);
231
250
  }
232
251
  if (options.viewmodel && !this.presentation.hasViewmodel(gameEntity.uuid)) {
@@ -301,4 +320,3 @@ export {
301
320
  FirstPersonPresentation,
302
321
  FirstPersonBehavior
303
322
  };
304
- //# sourceMappingURL=chunk-G2KUXVU6.js.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createBounds2DRect
3
- } from "./chunk-OPZ2LVS2.js";
3
+ } from "./chunk-TZQQYJYK.js";
4
4
  import {
5
5
  SyncStateMachine,
6
6
  import_typescript_fsm
7
- } from "./chunk-AS3HR7AS.js";
7
+ } from "./chunk-OBF6BIA2.js";
8
8
  import {
9
9
  defineBehavior
10
- } from "./chunk-EZNCCO4L.js";
10
+ } from "./chunk-YDLO5M7S.js";
11
11
 
12
12
  // src/lib/behaviors/screen-wrap/screen-wrap-fsm.ts
13
13
  var ScreenWrapState = /* @__PURE__ */ ((ScreenWrapState2) => {
@@ -176,4 +176,3 @@ export {
176
176
  ScreenWrapFSM,
177
177
  ScreenWrapBehavior
178
178
  };
179
- //# sourceMappingURL=chunk-2PAHQZZD.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  getBounds2DNormalFromHits
3
- } from "./chunk-OPZ2LVS2.js";
3
+ } from "./chunk-TZQQYJYK.js";
4
4
  import {
5
5
  updateBoundaryRicochet
6
- } from "./chunk-LL4FLHIY.js";
6
+ } from "./chunk-2YF7J3H4.js";
7
7
 
8
8
  // src/lib/coordinators/boundary-ricochet.coordinator.ts
9
9
  var BoundaryRicochetCoordinator = class {
@@ -37,4 +37,3 @@ var BoundaryRicochetCoordinator = class {
37
37
  export {
38
38
  BoundaryRicochetCoordinator
39
39
  };
40
- //# sourceMappingURL=chunk-NW4SE5XW.js.map
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  createThrusterInputComponent,
3
3
  createThrusterMovementComponent
4
- } from "./chunk-IZJFUAXB.js";
4
+ } from "./chunk-2HLZBWGD.js";
5
5
  import {
6
6
  SyncStateMachine,
7
7
  import_typescript_fsm
8
- } from "./chunk-AS3HR7AS.js";
8
+ } from "./chunk-OBF6BIA2.js";
9
9
  import {
10
10
  defineBehavior
11
- } from "./chunk-EZNCCO4L.js";
11
+ } from "./chunk-YDLO5M7S.js";
12
12
 
13
13
  // src/lib/behaviors/thruster/thruster-fsm.ts
14
14
  var ThrusterState = /* @__PURE__ */ ((ThrusterState2) => {
@@ -152,4 +152,3 @@ export {
152
152
  ThrusterFSM,
153
153
  ThrusterBehavior
154
154
  };
155
- //# sourceMappingURL=chunk-BAXJ7XHJ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  defineBehavior
3
- } from "./chunk-EZNCCO4L.js";
3
+ } from "./chunk-YDLO5M7S.js";
4
4
 
5
5
  // src/lib/behaviors/screen-visibility/screen-visibility.descriptor.ts
6
6
  import {
@@ -366,4 +366,3 @@ export {
366
366
  ScreenVisibilityFSM,
367
367
  ScreenVisibilityBehavior
368
368
  };
369
- //# sourceMappingURL=chunk-WOMHL23C.js.map
@@ -41,4 +41,3 @@ export {
41
41
  createJumpInput3D,
42
42
  createJumpState3D
43
43
  };
44
- //# sourceMappingURL=chunk-4WH2ZN7P.js.map
@@ -62,7 +62,8 @@ function readStageRenderSlot(view, slot, out) {
62
62
  position: [0, 0, 0],
63
63
  rotation: [0, 0, 0, 1],
64
64
  scale: 1,
65
- custom: [0, 0, 0, 0]
65
+ custom: [0, 0, 0, 0],
66
+ isSleeping: false
66
67
  };
67
68
  result.position[0] = view[base];
68
69
  result.position[1] = view[base + 1];
@@ -77,6 +78,7 @@ function readStageRenderSlot(view, slot, out) {
77
78
  result.custom[1] = view[base + 9];
78
79
  result.custom[2] = view[base + 10];
79
80
  result.custom[3] = view[base + 11];
81
+ result.isSleeping = result.custom[3] > 0.5;
80
82
  return result;
81
83
  }
82
84
  var WasmStageRuntime = class {
@@ -158,6 +160,26 @@ var WasmStageRuntime = class {
158
160
  setEventsEnabled(enabled) {
159
161
  this.exports.zylem_stage_set_events_enabled(enabled ? 1 : 0);
160
162
  }
163
+ /** Cap Rapier contact solver iterations (default 4). */
164
+ setSolverIterations(iterations) {
165
+ this.exports.zylem_stage_set_solver_iterations(Math.max(1, iterations | 0));
166
+ }
167
+ /**
168
+ * Override sleep activation thresholds for sleep-capable dynamic bodies.
169
+ * Higher velocity thresholds / lower `timeUntilSleep` put piles to sleep
170
+ * sooner.
171
+ */
172
+ setSleepThresholds(normalizedLinearThreshold, angularThreshold, timeUntilSleep) {
173
+ this.exports.zylem_stage_set_sleep_thresholds(
174
+ normalizedLinearThreshold,
175
+ angularThreshold,
176
+ timeUntilSleep
177
+ );
178
+ }
179
+ /** Number of awake (non-sleeping) dynamic rigid bodies. */
180
+ awakeDynamicCount() {
181
+ return this.exports.zylem_stage_awake_dynamic_count();
182
+ }
161
183
  // ─── Entity lifecycle ───────────────────────────────────────────────
162
184
  createEntity() {
163
185
  const slot = this.exports.zylem_stage_create_entity() >>> 0;
@@ -864,4 +886,3 @@ export {
864
886
  WasmStageRuntime,
865
887
  createWasmStageRuntime
866
888
  };
867
- //# sourceMappingURL=chunk-DZ4LLQON.js.map
@@ -28,4 +28,3 @@ export {
28
28
  __commonJS,
29
29
  __toESM
30
30
  };
31
- //# sourceMappingURL=chunk-5WRI5ZAA.js.map
@@ -21,4 +21,3 @@ export {
21
21
  createTransformComponent,
22
22
  createPhysicsBodyComponent
23
23
  };
24
- //# sourceMappingURL=chunk-5A5AYP2C.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getEntityFacingAngle2D,
3
3
  resolveAim2D
4
- } from "./chunk-TBUKJKY6.js";
4
+ } from "./chunk-VJ3UA6OD.js";
5
5
 
6
6
  // src/lib/coordinators/shared/shooter-fire.ts
7
7
  function fireShooter2DIfRequested(entity, shooter, stage, input, aim) {
@@ -27,4 +27,3 @@ function fireShooter2DIfRequested(entity, shooter, stage, input, aim) {
27
27
  export {
28
28
  fireShooter2DIfRequested
29
29
  };
30
- //# sourceMappingURL=chunk-52FJIDGL.js.map
@@ -4,17 +4,17 @@ import {
4
4
  constrainMovementToBounds3D,
5
5
  hasAnyBounds3DHit,
6
6
  insetBounds3D
7
- } from "./chunk-OHCPV2NT.js";
7
+ } from "./chunk-WHKPWIQO.js";
8
8
  import {
9
9
  SyncStateMachine,
10
10
  import_typescript_fsm
11
- } from "./chunk-AS3HR7AS.js";
11
+ } from "./chunk-OBF6BIA2.js";
12
12
  import {
13
13
  StageBoundaryDim
14
- } from "./chunk-DZ4LLQON.js";
14
+ } from "./chunk-GZ3DQIIZ.js";
15
15
  import {
16
16
  defineBehavior
17
- } from "./chunk-EZNCCO4L.js";
17
+ } from "./chunk-YDLO5M7S.js";
18
18
 
19
19
  // src/lib/behaviors/world-boundary-3d/world-boundary-3d-fsm.ts
20
20
  var WorldBoundary3DState = /* @__PURE__ */ ((WorldBoundary3DState2) => {
@@ -198,4 +198,3 @@ export {
198
198
  WorldBoundary3DFSM,
199
199
  WorldBoundary3DBehavior
200
200
  };
201
- //# sourceMappingURL=chunk-WU6XXL3D.js.map
@@ -111,4 +111,3 @@ export {
111
111
  toThreeVector2,
112
112
  toThreeVector3
113
113
  };
114
- //# sourceMappingURL=chunk-M3QDKKDF.js.map
@@ -2,17 +2,17 @@ import {
2
2
  computeBounds2DHits,
3
3
  constrainMovementToBounds2D,
4
4
  hasAnyBounds2DHit
5
- } from "./chunk-OPZ2LVS2.js";
5
+ } from "./chunk-TZQQYJYK.js";
6
6
  import {
7
7
  SyncStateMachine,
8
8
  import_typescript_fsm
9
- } from "./chunk-AS3HR7AS.js";
9
+ } from "./chunk-OBF6BIA2.js";
10
10
  import {
11
11
  StageBoundaryDim
12
- } from "./chunk-DZ4LLQON.js";
12
+ } from "./chunk-GZ3DQIIZ.js";
13
13
  import {
14
14
  defineBehavior
15
- } from "./chunk-EZNCCO4L.js";
15
+ } from "./chunk-YDLO5M7S.js";
16
16
 
17
17
  // src/lib/behaviors/world-boundary-2d/world-boundary-2d-fsm.ts
18
18
  var WorldBoundary2DState = /* @__PURE__ */ ((WorldBoundary2DState2) => {
@@ -190,4 +190,3 @@ export {
190
190
  WorldBoundary2DFSM,
191
191
  WorldBoundary2DBehavior
192
192
  };
193
- //# sourceMappingURL=chunk-7DGXUAPV.js.map
@@ -6,14 +6,14 @@ import {
6
6
  magicPresets,
7
7
  particleEffect,
8
8
  waterPresets
9
- } from "./chunk-7JJEIADR.js";
9
+ } from "./chunk-UF7QPYUX.js";
10
10
  import {
11
11
  VEC3_ZERO,
12
12
  normalizeVec3
13
- } from "./chunk-M3QDKKDF.js";
13
+ } from "./chunk-LWM346FW.js";
14
14
  import {
15
15
  defineBehavior
16
- } from "./chunk-EZNCCO4L.js";
16
+ } from "./chunk-YDLO5M7S.js";
17
17
 
18
18
  // src/lib/behaviors/particle-emitter/particle-emitter.descriptor.ts
19
19
  import { Group, Quaternion, Vector3 } from "three";
@@ -410,4 +410,3 @@ export {
410
410
  ParticleEmitterBehavior,
411
411
  particlePresets
412
412
  };
413
- //# sourceMappingURL=chunk-7JLWZXPA.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __commonJS,
3
3
  __toESM
4
- } from "./chunk-5WRI5ZAA.js";
4
+ } from "./chunk-JSBRDJBE.js";
5
5
 
6
6
  // node_modules/.pnpm/typescript-fsm@1.6.0/node_modules/typescript-fsm/dist/stateMachine.js
7
7
  var require_stateMachine = __commonJS({
@@ -185,4 +185,3 @@ export {
185
185
  SyncStateMachine,
186
186
  import_typescript_fsm2 as import_typescript_fsm
187
187
  };
188
- //# sourceMappingURL=chunk-AS3HR7AS.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  fireShooter2DIfRequested
3
- } from "./chunk-52FJIDGL.js";
3
+ } from "./chunk-LAN7U3AK.js";
4
4
  import {
5
5
  createTopDownMovementInputComponent
6
- } from "./chunk-EIWQM6U3.js";
6
+ } from "./chunk-2HKY6WF7.js";
7
7
 
8
8
  // src/lib/coordinators/top-down-shooter.coordinator.ts
9
9
  var TopDownShooterCoordinator = class {
@@ -30,4 +30,3 @@ var TopDownShooterCoordinator = class {
30
30
  export {
31
31
  TopDownShooterCoordinator
32
32
  };
33
- //# sourceMappingURL=chunk-KIYUUSPK.js.map
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  SyncStateMachine,
3
3
  import_typescript_fsm
4
- } from "./chunk-AS3HR7AS.js";
4
+ } from "./chunk-OBF6BIA2.js";
5
5
  import {
6
6
  STAGE_INPUT_BUTTON_JUMP,
7
7
  readBehaviorSnapshot
8
- } from "./chunk-DZ4LLQON.js";
8
+ } from "./chunk-GZ3DQIIZ.js";
9
9
  import {
10
10
  defineBehavior
11
- } from "./chunk-EZNCCO4L.js";
11
+ } from "./chunk-YDLO5M7S.js";
12
12
 
13
13
  // src/lib/behaviors/jumper-2d/components.ts
14
14
  function createJumpConfig2D(options = {}) {
@@ -207,4 +207,3 @@ export {
207
207
  Jumper2DFSM,
208
208
  Jumper2DBehavior
209
209
  };
210
- //# sourceMappingURL=chunk-4CEW64HO.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createFirstPersonInputComponent
3
- } from "./chunk-QVCMJ4Q2.js";
3
+ } from "./chunk-4EWASZHB.js";
4
4
  import {
5
5
  createJumpInput3D
6
- } from "./chunk-4WH2ZN7P.js";
6
+ } from "./chunk-F7E23E26.js";
7
7
 
8
8
  // src/lib/coordinators/first-person-shooter.coordinator.ts
9
9
  var FirstPersonShooterCoordinator = class {
@@ -61,4 +61,3 @@ var FirstPersonShooterCoordinator = class {
61
61
  export {
62
62
  FirstPersonShooterCoordinator
63
63
  };
64
- //# sourceMappingURL=chunk-H4TJ7X4O.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  getBounds3DNormalFromHits
3
- } from "./chunk-OHCPV2NT.js";
3
+ } from "./chunk-WHKPWIQO.js";
4
4
  import {
5
5
  updateBoundaryRicochet
6
- } from "./chunk-LL4FLHIY.js";
6
+ } from "./chunk-2YF7J3H4.js";
7
7
 
8
8
  // src/lib/coordinators/boundary-ricochet-3d.coordinator.ts
9
9
  var BoundaryRicochet3DCoordinator = class {
@@ -37,4 +37,3 @@ var BoundaryRicochet3DCoordinator = class {
37
37
  export {
38
38
  BoundaryRicochet3DCoordinator
39
39
  };
40
- //# sourceMappingURL=chunk-KFFETUAL.js.map