@zylem/game-lib 0.6.4 → 0.8.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 (156) hide show
  1. package/README.md +18 -2
  2. package/dist/actions.d.ts +321 -11
  3. package/dist/actions.js +1 -936
  4. package/dist/api/game-lib.api.json +54074 -0
  5. package/dist/api/game-lib.api.md +4544 -0
  6. package/dist/api/game-lib.d.ts +8258 -0
  7. package/dist/api/game-lib.typedoc.json +345421 -0
  8. package/dist/audio.d.ts +13 -0
  9. package/dist/audio.js +1 -0
  10. package/dist/base-node-life-cycle-D2NuN1VB.d.ts +151 -0
  11. package/dist/behavior.d.ts +2 -0
  12. package/dist/behavior.js +1 -0
  13. package/dist/blueprints-TbGY-h53.d.ts +162 -0
  14. package/dist/chunk-4QLJUQSJ.js +1 -0
  15. package/dist/chunk-7FR5JSQ2.js +1 -0
  16. package/dist/chunk-7GYFZKK7.js +1 -0
  17. package/dist/chunk-7WRQ2UAN.js +1 -0
  18. package/dist/chunk-BH53MBAZ.js +1 -0
  19. package/dist/chunk-BIGH6D34.js +0 -0
  20. package/dist/chunk-CM5YRNBJ.js +19 -0
  21. package/dist/chunk-COM6HJ2L.js +1 -0
  22. package/dist/chunk-D2PATZCC.js +1 -0
  23. package/dist/chunk-DFLI7ICU.js +0 -0
  24. package/dist/chunk-E3UBSUPX.js +1 -0
  25. package/dist/chunk-FKIKN7RP.js +24 -0
  26. package/dist/chunk-G4HONLWC.js +1 -0
  27. package/dist/chunk-IKWE2W6L.js +1 -0
  28. package/dist/chunk-IPWUDOV5.js +1 -0
  29. package/dist/chunk-JEHFHUH4.js +0 -0
  30. package/dist/chunk-JNKPTL77.js +1 -0
  31. package/dist/chunk-JQKS42G4.js +1 -0
  32. package/dist/chunk-M3XNO56P.js +1 -0
  33. package/dist/chunk-MSC2BEO5.js +1 -0
  34. package/dist/chunk-ORIDWL3T.js +0 -0
  35. package/dist/chunk-QB3NL7VQ.js +1 -0
  36. package/dist/chunk-QXVH6POE.js +1 -0
  37. package/dist/chunk-RXDTAWI2.js +29 -0
  38. package/dist/chunk-TAUWDQZF.js +9 -0
  39. package/dist/chunk-VS2D4B3W.js +1 -0
  40. package/dist/chunk-WQ3WMMZD.js +1 -0
  41. package/dist/chunk-XK63E4SX.js +1 -0
  42. package/dist/chunk-XNDS4YFR.js +1 -0
  43. package/dist/chunk-XNHVRFAK.js +1 -0
  44. package/dist/chunk-XRP4JJXL.js +1 -0
  45. package/dist/chunk-YHEWKN7N.js +1 -0
  46. package/dist/chunk-ZRT3ZQVH.js +1 -0
  47. package/dist/collision-builder-jF-toPIl.d.ts +38 -0
  48. package/dist/core.d.ts +223 -16
  49. package/dist/core.js +1 -12424
  50. package/dist/debug-state-BPT6jEog.d.ts +17 -0
  51. package/dist/debug.d.ts +76 -0
  52. package/dist/debug.js +1 -0
  53. package/dist/default-controls-0-vCnli7.d.ts +111 -0
  54. package/dist/{entity-vj-HTjzU.d.ts → entity-BdSI8CL3.d.ts} +119 -626
  55. package/dist/{entity-Bq_eNEDI.d.ts → entity-DZbFQ1Wg.d.ts} +4 -4
  56. package/dist/entity-type-map-Bd69SpAS.d.ts +928 -0
  57. package/dist/entity.d.ts +268 -0
  58. package/dist/entity.js +1 -0
  59. package/dist/events.d.ts +181 -0
  60. package/dist/events.js +1 -0
  61. package/dist/game-C1FHVqXl.d.ts +1886 -0
  62. package/dist/game-default-QHROHW2O.js +1 -0
  63. package/dist/game-interfaces-mchNYSZE.d.ts +90 -0
  64. package/dist/globals.d.ts +115 -0
  65. package/dist/globals.js +1 -0
  66. package/dist/graphics.d.ts +53 -0
  67. package/dist/graphics.js +1 -0
  68. package/dist/input-ui.d.ts +35 -0
  69. package/dist/input-ui.js +1 -0
  70. package/dist/input.d.ts +73 -0
  71. package/dist/input.js +1 -0
  72. package/dist/material-9vJ6SZaI.d.ts +126 -0
  73. package/dist/public.d.ts +38 -0
  74. package/dist/public.js +1 -0
  75. package/dist/runtime.d.ts +59 -0
  76. package/dist/runtime.js +1 -0
  77. package/dist/schema/entity.schema.json +244 -0
  78. package/dist/schema/game-config.schema.json +625 -0
  79. package/dist/schema/input-config.schema.json +499 -0
  80. package/dist/schema/stage-config.schema.json +93 -0
  81. package/dist/schema/stage.schema.json +271 -0
  82. package/dist/schema.d.ts +538 -0
  83. package/dist/schema.js +1 -0
  84. package/dist/stage-transition-CmGpV4tc.d.ts +46 -0
  85. package/dist/vector-CiSHbivc.d.ts +133 -0
  86. package/dist/web-components.d.ts +70 -0
  87. package/dist/web-components.js +1 -0
  88. package/dist/zylem-camera-C3bn6BTI.d.ts +575 -0
  89. package/package.json +70 -73
  90. package/dist/actions.js.map +0 -1
  91. package/dist/behavior/jumper-2d.d.ts +0 -114
  92. package/dist/behavior/jumper-2d.js +0 -711
  93. package/dist/behavior/jumper-2d.js.map +0 -1
  94. package/dist/behavior/platformer-3d.d.ts +0 -296
  95. package/dist/behavior/platformer-3d.js +0 -761
  96. package/dist/behavior/platformer-3d.js.map +0 -1
  97. package/dist/behavior/ricochet-2d.d.ts +0 -275
  98. package/dist/behavior/ricochet-2d.js +0 -425
  99. package/dist/behavior/ricochet-2d.js.map +0 -1
  100. package/dist/behavior/ricochet-3d.d.ts +0 -117
  101. package/dist/behavior/ricochet-3d.js +0 -443
  102. package/dist/behavior/ricochet-3d.js.map +0 -1
  103. package/dist/behavior/screen-visibility.d.ts +0 -79
  104. package/dist/behavior/screen-visibility.js +0 -358
  105. package/dist/behavior/screen-visibility.js.map +0 -1
  106. package/dist/behavior/screen-wrap.d.ts +0 -87
  107. package/dist/behavior/screen-wrap.js +0 -246
  108. package/dist/behavior/screen-wrap.js.map +0 -1
  109. package/dist/behavior/shooter-2d.d.ts +0 -79
  110. package/dist/behavior/shooter-2d.js +0 -180
  111. package/dist/behavior/shooter-2d.js.map +0 -1
  112. package/dist/behavior/thruster.d.ts +0 -11
  113. package/dist/behavior/thruster.js +0 -292
  114. package/dist/behavior/thruster.js.map +0 -1
  115. package/dist/behavior/top-down-movement.d.ts +0 -56
  116. package/dist/behavior/top-down-movement.js +0 -125
  117. package/dist/behavior/top-down-movement.js.map +0 -1
  118. package/dist/behavior/world-boundary-2d.d.ts +0 -142
  119. package/dist/behavior/world-boundary-2d.js +0 -235
  120. package/dist/behavior/world-boundary-2d.js.map +0 -1
  121. package/dist/behavior/world-boundary-3d.d.ts +0 -76
  122. package/dist/behavior/world-boundary-3d.js +0 -274
  123. package/dist/behavior/world-boundary-3d.js.map +0 -1
  124. package/dist/behavior-descriptor-BXnVR8Ki.d.ts +0 -159
  125. package/dist/blueprints-DmbK2dki.d.ts +0 -26
  126. package/dist/camera-4XO5gbQH.d.ts +0 -905
  127. package/dist/camera.d.ts +0 -6
  128. package/dist/camera.js +0 -1993
  129. package/dist/camera.js.map +0 -1
  130. package/dist/composition-BASvMKrW.d.ts +0 -218
  131. package/dist/core-CARRaS55.d.ts +0 -541
  132. package/dist/core.js.map +0 -1
  133. package/dist/entities-ChFirVL9.d.ts +0 -410
  134. package/dist/entities.d.ts +0 -9
  135. package/dist/entities.js +0 -4986
  136. package/dist/entities.js.map +0 -1
  137. package/dist/entity-types-DAu8sGJH.d.ts +0 -26
  138. package/dist/global-change-2JvMaz44.d.ts +0 -25
  139. package/dist/main.d.ts +0 -1353
  140. package/dist/main.js +0 -19525
  141. package/dist/main.js.map +0 -1
  142. package/dist/physics-pose-DCc4oE44.d.ts +0 -25
  143. package/dist/physics-protocol-BDD3P5W2.d.ts +0 -200
  144. package/dist/physics-worker.d.ts +0 -21
  145. package/dist/physics-worker.js +0 -306
  146. package/dist/physics-worker.js.map +0 -1
  147. package/dist/physics.d.ts +0 -205
  148. package/dist/physics.js +0 -577
  149. package/dist/physics.js.map +0 -1
  150. package/dist/stage-types-C19IhuzA.d.ts +0 -731
  151. package/dist/stage.d.ts +0 -52
  152. package/dist/stage.js +0 -8479
  153. package/dist/stage.js.map +0 -1
  154. package/dist/sync-state-machine-CZyspBpj.d.ts +0 -16
  155. package/dist/thruster-23lzoPZd.d.ts +0 -180
  156. package/dist/world-DfgxoNMt.d.ts +0 -105
package/README.md CHANGED
@@ -15,10 +15,24 @@ This library is intended for hobbyist developers who want to play with 3D web te
15
15
  The goal is to give you tools to build simple 3D games. It's basically comprised of:
16
16
 
17
17
  - Rendering via ThreeJS with some capability to handle postprocessing built-in. [ThreeJS](https://threejs.org/)
18
- - Collision handling, triggers, and rigid body physics via RapierRS [RapierRS](https://rapier.rs/)
18
+ - Collision handling, triggers, and rigid body physics simulated in WebAssembly (Rapier compiled to WASM via [@zylem/runtime](https://www.npmjs.com/package/@zylem/runtime), driven through [@zylem/behaviors](https://www.npmjs.com/package/@zylem/behaviors))
19
19
  - Game state management with Valtio [Valtio](https://valtio.dev/)
20
20
  - Simplified input handling (gamepad, keyboard, mouse)
21
21
 
22
+ **Architecture layers**
23
+
24
+ Zylem is split into three packages, each a strict layer over the one below:
25
+
26
+ | Layer | Package | Owns |
27
+ | --- | --- | --- |
28
+ | Game framework | `@zylem/game-lib` | Three.js rendering, input, assets, stages, game state |
29
+ | Simulation | `@zylem/behaviors` | `createSimulation()`, entity registry, behavior FSMs, event translation, runtime ownership |
30
+ | Runtime | `@zylem/runtime` | WASM module: ECS + Rapier physics, slot-indexed input/render/snapshot/event buffers |
31
+
32
+ Each frame, game-lib forwards behavior inputs into the simulation, calls `simulation.update(delta)` (fixed-timestep physics inside WASM), then syncs interpolated render poses onto Three.js objects. Disposal follows the same chain: `Game.dispose()` → `Simulation.dispose()` → WASM stage destroy.
33
+
34
+ Games normally never touch the runtime directly; for debug tooling there is an escape hatch: `game.experimental.getRuntime()` returns the underlying `Simulation`.
35
+
22
36
  > Note: This project is still in alpha. There are unfinished features and some APIs that may change.
23
37
 
24
38
  ## Installation
@@ -39,7 +53,9 @@ npm install @zylem/game-lib
39
53
  * the ball can be controlled with the arrow keys or gamepad
40
54
  * the ball cannot go outside the boundaries
41
55
  */
42
- import { createGame, createSphere, WorldBoundary2DBehavior } from '@zylem/game-lib';
56
+ import { createGame } from '@zylem/game-lib/core';
57
+ import { createSphere } from '@zylem/game-lib/entity';
58
+ import { WorldBoundary2DBehavior } from '@zylem/game-lib/behavior';
43
59
 
44
60
  // Creates a sphere (movement capabilities are built-in)
45
61
  const ball = createSphere();
package/dist/actions.d.ts CHANGED
@@ -1,19 +1,329 @@
1
- import { T as TransformState } from './entity-vj-HTjzU.js';
2
- export { A as Action, c as createTransformStore, i as getPosition, H as getRotation, j as getVelocity, m as move, h as moveForwardXY, a as moveX, e as moveXY, f as moveXZ, b as moveY, d as moveZ, r as resetTransformStore, g as resetVelocity, t as rotateEuler, p as rotateInDirection, u as rotateX, v as rotateY, q as rotateYEuler, x as rotateZ, s as setPosition, k as setPositionX, l as setPositionY, n as setPositionZ, G as setRotation, C as setRotationDegrees, E as setRotationDegreesX, D as setRotationDegreesY, F as setRotationDegreesZ, z as setRotationX, y as setRotationY, B as setRotationZ, o as wrapAround3D, w as wrapAroundXY } from './entity-vj-HTjzU.js';
3
- export { c as callFunc, d as delay, m as moveBy, a as moveTo, o as onPress, b as onRelease, p as parallel, e as repeat, f as repeatForever, r as rotateBy, s as sequence, t as throttle } from './composition-BASvMKrW.js';
4
- import { RigidBody } from '@dimforge/rapier3d-compat';
5
- export { g as globalChange, a as globalChanges, v as variableChange, b as variableChanges } from './global-change-2JvMaz44.js';
6
- import 'three';
7
- import 'bitecs';
1
+ import { A as Action, G as GameEntity } from './entity-BdSI8CL3.js';
2
+ export { x as getRotation, i as rotateEuler, r as rotateInDirection, j as rotateX, k as rotateY, h as rotateYEuler, l as rotateZ, w as setRotation, q as setRotationDegrees, u as setRotationDegreesX, t as setRotationDegreesY, v as setRotationDegreesZ, n as setRotationX, m as setRotationY, o as setRotationZ } from './entity-BdSI8CL3.js';
3
+ import { Object3D } from 'three';
4
+ import { TransformState } from '@zylem/behaviors/core';
5
+ export { TransformState, createTransformStore, getPosition, getVelocity, move, moveForwardXY, moveX, moveXY, moveXZ, moveY, moveZ, resetVelocity, setPosition, setPositionX, setPositionY, setPositionZ, wrapAround3D, wrapAroundXY } from '@zylem/behaviors/core';
6
+ import './vector-CiSHbivc.js';
7
+ import './material-9vJ6SZaI.js';
8
+ import 'three/webgpu';
9
+ import './collision-builder-jF-toPIl.js';
10
+ import './base-node-life-cycle-D2NuN1VB.js';
11
+ import './stage-transition-CmGpV4tc.js';
12
+ import './events.js';
8
13
  import 'mitt';
9
- import './behavior-descriptor-BXnVR8Ki.js';
10
14
 
15
+ /** Minimal entity shape for opacity helpers (avoids GameEntity generic variance). */
16
+ type OpacityEntity = {
17
+ group?: Object3D | null;
18
+ mesh?: Object3D | null;
19
+ };
11
20
  /**
12
- * Entity that can have transformations applied from a store
21
+ * Sets opacity on every fadeable material under an entity's visual root.
22
+ */
23
+ declare function resetEntityOpacity(entity: OpacityEntity, opacity?: number, transparent?: boolean): void;
24
+ interface MoveByOptions {
25
+ /** X displacement (default: 0) */
26
+ x?: number;
27
+ /** Y displacement (default: 0) */
28
+ y?: number;
29
+ /** Z displacement (default: 0) */
30
+ z?: number;
31
+ /** Duration in milliseconds */
32
+ duration: number;
33
+ }
34
+ /**
35
+ * Move an entity by a displacement over a duration.
36
+ * Distributes the movement as velocity each frame so physics stays in sync.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * entity.runAction(moveBy({ x: 10, duration: 500 }));
41
+ * ```
42
+ */
43
+ declare function moveBy(opts: MoveByOptions): Action;
44
+ interface MoveToOptions {
45
+ /** Target X position */
46
+ x: number;
47
+ /** Target Y position */
48
+ y: number;
49
+ /** Target Z position */
50
+ z: number;
51
+ /** Duration in milliseconds */
52
+ duration: number;
53
+ }
54
+ /**
55
+ * Move an entity to an absolute position over a duration.
56
+ * Calculates displacement from the entity's position on the first tick.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * entity.runAction(moveTo({ x: 0, y: 10, z: 0, duration: 2000 }));
61
+ * ```
62
+ */
63
+ declare function moveTo(opts: MoveToOptions): Action;
64
+ interface RotateByOptions {
65
+ /** X rotation in degrees (default: 0) */
66
+ x?: number;
67
+ /** Y rotation in degrees (default: 0) */
68
+ y?: number;
69
+ /** Z rotation in degrees (default: 0) */
70
+ z?: number;
71
+ /** Duration in milliseconds */
72
+ duration: number;
73
+ }
74
+ /**
75
+ * Rotate an entity by euler angles (degrees) over a duration.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * entity.runAction(rotateBy({ y: 360, duration: 2000 }));
80
+ * ```
81
+ */
82
+ declare function rotateBy(opts: RotateByOptions): Action;
83
+ /**
84
+ * Wait for a duration. Useful inside `sequence()`.
85
+ *
86
+ * @param ms Duration in milliseconds
87
+ * @example
88
+ * ```ts
89
+ * entity.runAction(sequence(moveBy({ x: 5, duration: 1000 }), delay(500), moveBy({ y: 3, duration: 1000 })));
90
+ * ```
91
+ */
92
+ declare function delay(ms: number): Action;
93
+ /**
94
+ * Call a function immediately. Completes in one frame.
95
+ * Useful inside `sequence()` for side effects.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * entity.runAction(sequence(moveBy({ x: 5, duration: 1000 }), callFunc(() => console.log('done'))));
100
+ * ```
101
+ */
102
+ declare function callFunc(fn: () => void): Action;
103
+ interface FadeOpacityOptions {
104
+ /** Starting opacity (default: 1) */
105
+ from?: number;
106
+ /** Ending opacity (default: 0) */
107
+ to?: number;
108
+ /** Duration in milliseconds */
109
+ duration: number;
110
+ /** Optional Object3D roots to traverse; defaults to entity.group ?? entity.mesh */
111
+ targets?: Object3D[];
112
+ /** When complete and `to >= 1`, restore transparent=false on affected materials */
113
+ restoreOpaque?: boolean;
114
+ }
115
+ /**
116
+ * Fade material opacity on an entity (or explicit targets) over a duration.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * entity.runAction(fadeOpacity({ from: 0, to: 1, duration: 400, restoreOpaque: true }));
121
+ * ```
122
+ */
123
+ declare function fadeOpacity(opts: FadeOpacityOptions): Action;
124
+
125
+ interface ThrottleOptions {
126
+ /** Interval in milliseconds between ready cycles */
127
+ duration: number;
128
+ }
129
+ /**
130
+ * A repeating timer that becomes ready every N milliseconds.
131
+ * Register with `entity.action(throttle(...))`.
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * const t = entity.action(throttle({ duration: 500 }));
136
+ * entity.onUpdate(() => {
137
+ * if (t.ready) { t.consume(); // do something every 500ms }
138
+ * });
139
+ * ```
140
+ */
141
+ declare function throttle(opts: ThrottleOptions): ThrottleAction;
142
+ declare class ThrottleAction implements Action {
143
+ readonly duration: number;
144
+ done: boolean;
145
+ persistent: boolean;
146
+ ready: boolean;
147
+ private elapsed;
148
+ /** @param durationMs Duration in milliseconds */
149
+ constructor(durationMs: number);
150
+ tick(_entity: GameEntity<any>, delta: number): void;
151
+ /** Consume the ready state and reset the timer */
152
+ consume(): void;
153
+ reset(): void;
154
+ }
155
+ /**
156
+ * Detects the rising edge of a boolean signal (press).
157
+ * Call `.check(isPressed)` each frame in your onUpdate; `.triggered` is
158
+ * true for one frame on press.
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * const press = entity.action(onPress());
163
+ * entity.onUpdate(({ inputs }) => {
164
+ * press.check(inputs.p1.buttons.A.pressed);
165
+ * if (press.triggered) { // do something once on press }
166
+ * });
167
+ * ```
168
+ */
169
+ declare function onPress(): OnPressAction;
170
+ declare class OnPressAction implements Action {
171
+ readonly duration: number;
172
+ done: boolean;
173
+ persistent: boolean;
174
+ triggered: boolean;
175
+ private wasPressed;
176
+ tick(): void;
177
+ /**
178
+ * Feed the current pressed state. Sets `.triggered = true` on the
179
+ * frame where `isPressed` transitions from false to true.
180
+ */
181
+ check(isPressed: boolean): void;
182
+ reset(): void;
183
+ }
184
+ /**
185
+ * Detects the falling edge of a boolean signal (release).
186
+ * Call `.check(isPressed)` each frame; `.triggered` is true for one frame
187
+ * on release.
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * const release = entity.action(onRelease());
192
+ * entity.onUpdate(({ inputs }) => {
193
+ * release.check(inputs.p1.buttons.A.pressed);
194
+ * if (release.triggered) { // do something once on release }
195
+ * });
196
+ * ```
197
+ */
198
+ declare function onRelease(): OnReleaseAction;
199
+ declare class OnReleaseAction implements Action {
200
+ readonly duration: number;
201
+ done: boolean;
202
+ persistent: boolean;
203
+ triggered: boolean;
204
+ private wasPressed;
205
+ tick(): void;
206
+ /**
207
+ * Feed the current pressed state. Sets `.triggered = true` on the
208
+ * frame where `isPressed` transitions from true to false.
209
+ */
210
+ check(isPressed: boolean): void;
211
+ reset(): void;
212
+ }
213
+
214
+ /**
215
+ * Run actions in order, one after another.
216
+ *
217
+ * @example
218
+ * ```ts
219
+ * entity.runAction(sequence(
220
+ * moveBy({ x: 5, duration: 1000 }),
221
+ * delay(500),
222
+ * moveBy({ y: 3, duration: 1000 }),
223
+ * ));
224
+ * ```
225
+ */
226
+ declare function sequence(...actions: Action[]): Action;
227
+ /**
228
+ * Run all actions simultaneously. Done when all children are done.
229
+ *
230
+ * @example
231
+ * ```ts
232
+ * entity.runAction(parallel(
233
+ * moveBy({ x: 5, duration: 1000 }),
234
+ * rotateBy({ y: 360, duration: 1000 }),
235
+ * ));
236
+ * ```
237
+ */
238
+ declare function parallel(...actions: Action[]): Action;
239
+ /**
240
+ * Repeat an action a fixed number of times.
241
+ *
242
+ * @example
243
+ * ```ts
244
+ * entity.runAction(repeat(moveBy({ x: 2, duration: 500 }), 5));
245
+ * ```
246
+ */
247
+ declare function repeat(action: Action, times: number): Action;
248
+ /**
249
+ * Repeat an action forever. Never completes.
250
+ *
251
+ * @example
252
+ * ```ts
253
+ * enemy.runAction(repeatForever(
254
+ * sequence(moveBy({ x: 3, duration: 2000 }), moveBy({ x: -3, duration: 2000 })),
255
+ * ));
256
+ * ```
257
+ */
258
+ declare function repeatForever(action: Action): Action;
259
+
260
+ /**
261
+ * Structural slice of the simulation body facade used to flush transform
262
+ * intents. `SimulationBody` satisfies this shape.
263
+ */
264
+ interface TransformableBodyLike {
265
+ linvel(): {
266
+ x: number;
267
+ y: number;
268
+ z: number;
269
+ };
270
+ translation(): {
271
+ x: number;
272
+ y: number;
273
+ z: number;
274
+ };
275
+ setLinvel(velocity: {
276
+ x: number;
277
+ y: number;
278
+ z: number;
279
+ }, wakeUp: boolean): void;
280
+ setTranslation(translation: {
281
+ x: number;
282
+ y: number;
283
+ z: number;
284
+ }, wakeUp: boolean): void;
285
+ setRotation(rotation: {
286
+ x: number;
287
+ y: number;
288
+ z: number;
289
+ w: number;
290
+ }, wakeUp: boolean): void;
291
+ setAngvel(velocity: {
292
+ x: number;
293
+ y: number;
294
+ z: number;
295
+ }, wakeUp: boolean): void;
296
+ }
297
+ /**
298
+ * Minimal slice of the WASM stage runtime used to apply transform intents via
299
+ * FFI. Kept structural so this module need not import the full runtime type.
300
+ */
301
+ interface RuntimeTransformTarget {
302
+ getLinearVelocity(slot: number, out?: [number, number, number]): [number, number, number] | null;
303
+ setLinearVelocity(slot: number, x: number, y: number, z: number): boolean;
304
+ setAngularVelocity(slot: number, x: number, y: number, z: number): boolean;
305
+ setRotation(slot: number, x: number, y: number, z: number, w: number): boolean;
306
+ setPosition(slot: number, x: number, y: number, z: number): boolean;
307
+ getPose(slot: number): {
308
+ position: [number, number, number];
309
+ rotation: [number, number, number, number];
310
+ } | null;
311
+ }
312
+ /**
313
+ * Entity that can have transformations applied from a store.
314
+ *
315
+ * When `body` (the simulation body facade) is present the intents flush
316
+ * through it; otherwise, if the entity carries a live WASM slot
317
+ * (`runtimeHandle` >= 0 + `wasmStageRef`), they flush through the runtime's
318
+ * FFI setters directly.
13
319
  */
14
320
  interface TransformableEntity {
15
- body: RigidBody | null;
321
+ body: TransformableBodyLike | null;
16
322
  transformStore?: TransformState;
323
+ /** Live WASM slot handle, or -1 when not runtime-attached. */
324
+ runtimeHandle?: number;
325
+ /** Runtime adapter the entity is attached to, if any. */
326
+ wasmStageRef?: RuntimeTransformTarget | null;
17
327
  }
18
328
  /**
19
329
  * Apply accumulated transformations from the store to the physics body.
@@ -31,4 +341,4 @@ interface TransformableEntity {
31
341
  */
32
342
  declare function applyTransformChanges(entity: TransformableEntity, store: TransformState): void;
33
343
 
34
- export { TransformState, applyTransformChanges };
344
+ export { Action, type FadeOpacityOptions, type MoveByOptions, type MoveToOptions, type OpacityEntity, type RotateByOptions, type ThrottleOptions, applyTransformChanges, callFunc, delay, fadeOpacity, moveBy, moveTo, onPress, onRelease, parallel, repeat, repeatForever, resetEntityOpacity, rotateBy, sequence, throttle };