@zylem/game-lib 0.8.0 → 0.8.2

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 (62) hide show
  1. package/dist/actions.d.ts +6 -6
  2. package/dist/api/game-lib.api.json +2045 -769
  3. package/dist/api/game-lib.api.md +74 -10
  4. package/dist/api/game-lib.d.ts +193 -4
  5. package/dist/api/game-lib.typedoc.json +47249 -40214
  6. package/dist/{base-node-life-cycle-D2NuN1VB.d.ts → base-node-life-cycle-BK9xebT9.d.ts} +6 -0
  7. package/dist/chunk-3PRBSSTS.js +24 -0
  8. package/dist/chunk-47DG7I7M.js +1 -0
  9. package/dist/chunk-7QF6YTEZ.js +1 -0
  10. package/dist/chunk-CD7ZOZ35.js +1 -0
  11. package/dist/chunk-CFVRRRZZ.js +1 -0
  12. package/dist/chunk-EVYHPR3J.js +1 -0
  13. package/dist/{chunk-M3XNO56P.js → chunk-JNFFTNMH.js} +1 -1
  14. package/dist/chunk-KVSJE4XD.js +1 -0
  15. package/dist/{chunk-XNDS4YFR.js → chunk-MZZCDXFB.js} +1 -1
  16. package/dist/{chunk-RXDTAWI2.js → chunk-PCFF4LLO.js} +1 -1
  17. package/dist/chunk-UG22Z42P.js +1 -0
  18. package/dist/chunk-YAOXFYOD.js +1 -0
  19. package/dist/{collision-builder-jF-toPIl.d.ts → collision-builder-B_tm8OVy.d.ts} +13 -2
  20. package/dist/core.d.ts +15 -15
  21. package/dist/core.js +1 -1
  22. package/dist/{debug-state-BPT6jEog.d.ts → debug-state-DRoeasG2.d.ts} +1 -1
  23. package/dist/debug.d.ts +6 -6
  24. package/dist/{default-controls-0-vCnli7.d.ts → default-controls-CAKJ5zlo.d.ts} +2 -2
  25. package/dist/{entity-DZbFQ1Wg.d.ts → entity-B9yZeBm4.d.ts} +7 -1
  26. package/dist/{entity-BdSI8CL3.d.ts → entity-BGEq1yfC.d.ts} +32 -4
  27. package/dist/{entity-type-map-Bd69SpAS.d.ts → entity-type-map-CW6RHQkx.d.ts} +5 -5
  28. package/dist/entity.d.ts +12 -10
  29. package/dist/entity.js +1 -1
  30. package/dist/events.d.ts +1 -1
  31. package/dist/{game-C1FHVqXl.d.ts → game-DbqBQiFC.d.ts} +40 -11
  32. package/dist/game-default-6AZZCNST.js +1 -0
  33. package/dist/{game-interfaces-mchNYSZE.d.ts → game-interfaces-vF5sRi1n.d.ts} +7 -1
  34. package/dist/globals.d.ts +1 -1
  35. package/dist/graphics.d.ts +5 -5
  36. package/dist/input-ui.d.ts +4 -4
  37. package/dist/input-ui.js +1 -1
  38. package/dist/input.d.ts +47 -4
  39. package/dist/input.js +1 -1
  40. package/dist/{material-9vJ6SZaI.d.ts → material-DbSuZBbP.d.ts} +1 -1
  41. package/dist/public.d.ts +13 -13
  42. package/dist/public.js +1 -1
  43. package/dist/runtime.d.ts +3 -3
  44. package/dist/runtime.js +1 -1
  45. package/dist/schema/game-config.schema.json +18 -0
  46. package/dist/schema/input-config.schema.json +18 -0
  47. package/dist/schema.d.ts +12 -0
  48. package/dist/schema.js +1 -1
  49. package/dist/{vector-CiSHbivc.d.ts → vector-DN6zlPoE.d.ts} +28 -0
  50. package/dist/web-components.d.ts +12 -12
  51. package/dist/{zylem-camera-C3bn6BTI.d.ts → zylem-camera-Du2UPW9O.d.ts} +13 -1
  52. package/package.json +1 -1
  53. package/dist/chunk-7FR5JSQ2.js +0 -1
  54. package/dist/chunk-E3UBSUPX.js +0 -1
  55. package/dist/chunk-FKIKN7RP.js +0 -24
  56. package/dist/chunk-G4HONLWC.js +0 -1
  57. package/dist/chunk-IKWE2W6L.js +0 -1
  58. package/dist/chunk-JEHFHUH4.js +0 -0
  59. package/dist/chunk-JNKPTL77.js +0 -1
  60. package/dist/chunk-MSC2BEO5.js +0 -1
  61. package/dist/chunk-XNHVRFAK.js +0 -1
  62. package/dist/game-default-QHROHW2O.js +0 -1
@@ -551,16 +551,19 @@ export interface CameraFeedOptions {
551
551
  // @public
552
552
  export class CameraManager {
553
553
  constructor();
554
+ activateDebugCamera(): boolean;
554
555
  // Warning: (ae-forgotten-export) The symbol "ZylemCamera" needs to be exported by the entry point public.d.ts
555
556
  get activeCameras(): ReadonlyArray<ZylemCamera>;
556
557
  addActiveCamera(nameOrRef: string | ZylemCamera): boolean;
557
558
  addCamera(camera: ZylemCamera, name?: string): string;
558
559
  get allCameras(): ReadonlyArray<ZylemCamera>;
559
560
  deactivateCamera(nameOrRef: string | ZylemCamera): boolean;
561
+ deactivateDebugCamera(): boolean;
560
562
  get debugCamera(): ZylemCamera | null;
561
563
  dispose(): void;
562
564
  ensureDefaultCamera(): ZylemCamera;
563
565
  getCamera(name: string): ZylemCamera | null;
566
+ get preDebugPrimary(): ZylemCamera | null;
564
567
  get primaryCamera(): ZylemCamera | null;
565
568
  removeCamera(nameOrRef: string | ZylemCamera): boolean;
566
569
  render(scene: Scene): void;
@@ -1282,6 +1285,7 @@ export class FirstPersonPerspective implements CameraPerspective {
1282
1285
  lookAt(target: Vector3, lerpSpeed?: number): void;
1283
1286
  get pitch(): number;
1284
1287
  resetZoom(): void;
1288
+ setEyeHeight(height: number): void;
1285
1289
  setLook(yaw: number, pitch: number): void;
1286
1290
  get yaw(): number;
1287
1291
  zoom(fov: number): void;
@@ -1419,6 +1423,9 @@ export const GameConfigJsonSchema: _sinclair_typebox.TObject<{
1419
1423
  mapping: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TArray<_sinclair_typebox.TString>>>;
1420
1424
  pointerLock: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
1421
1425
  sensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
1426
+ lookMode: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"delta">, _sinclair_typebox.TLiteral<"screenCenter">]>>;
1427
+ maxLookDegrees: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
1428
+ lookSensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
1422
1429
  }>>;
1423
1430
  touch: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
1424
1431
  enabled: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TBoolean, _sinclair_typebox.TLiteral<"auto">]>>;
@@ -1666,6 +1673,7 @@ export class GameEntity<O extends GameEntityOptions> extends BaseNode<O> impleme
1666
1673
  physicsWorldRef: unknown;
1667
1674
  // (undocumented)
1668
1675
  resetVelocity: () => void;
1676
+ reveal(): void;
1669
1677
  // (undocumented)
1670
1678
  rotateEuler: (eulerRotation: Vector3) => void;
1671
1679
  // (undocumented)
@@ -1715,6 +1723,10 @@ export class GameEntity<O extends GameEntityOptions> extends BaseNode<O> impleme
1715
1723
  // (undocumented)
1716
1724
  setRotationZ: (z: number) => void;
1717
1725
  _setup(params: SetupContext<this>): void;
1726
+ _spawnInProgress: boolean;
1727
+ _spawnPlacementPending: boolean;
1728
+ _spawnPlacementReady: boolean;
1729
+ _spawnPositionExplicit: boolean;
1718
1730
  _tickActions(delta: number): void;
1719
1731
  // (undocumented)
1720
1732
  transformStore: TransformState;
@@ -1735,6 +1747,8 @@ export type GameEntityOptions = {
1735
1747
  color?: Color;
1736
1748
  size?: Vec3Input;
1737
1749
  position?: Vec3Input;
1750
+ hideUntilPositioned?: boolean;
1751
+ visible?: boolean;
1738
1752
  category?: RenderCategory_2;
1739
1753
  runtime?: RuntimeEntityOptions;
1740
1754
  collision?: Partial<CollisionOptions>;
@@ -1796,6 +1810,9 @@ export const GameInputConfigSchema: _sinclair_typebox.TRecord<_sinclair_typebox.
1796
1810
  mapping: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TArray<_sinclair_typebox.TString>>>;
1797
1811
  pointerLock: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
1798
1812
  sensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
1813
+ lookMode: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"delta">, _sinclair_typebox.TLiteral<"screenCenter">]>>;
1814
+ maxLookDegrees: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
1815
+ lookSensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
1799
1816
  }>>;
1800
1817
  touch: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
1801
1818
  enabled: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TBoolean, _sinclair_typebox.TLiteral<"auto">]>>;
@@ -1889,6 +1906,9 @@ export const GameInputPlayerConfigSchema: _sinclair_typebox.TObject<{
1889
1906
  mapping: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TArray<_sinclair_typebox.TString>>>;
1890
1907
  pointerLock: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
1891
1908
  sensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
1909
+ lookMode: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"delta">, _sinclair_typebox.TLiteral<"screenCenter">]>>;
1910
+ maxLookDegrees: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
1911
+ lookSensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
1892
1912
  }>>;
1893
1913
  touch: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
1894
1914
  enabled: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TBoolean, _sinclair_typebox.TLiteral<"auto">]>>;
@@ -2085,6 +2105,8 @@ export interface InputGamepad {
2085
2105
  pointer?: {
2086
2106
  x: number;
2087
2107
  y: number;
2108
+ centerX: number;
2109
+ centerY: number;
2088
2110
  };
2089
2111
  // (undocumented)
2090
2112
  shoulders: {
@@ -2258,7 +2280,10 @@ export { mod }
2258
2280
 
2259
2281
  // @public (undocumented)
2260
2282
  export interface MouseConfig {
2283
+ lookMode?: 'delta' | 'screenCenter';
2284
+ lookSensitivity?: number;
2261
2285
  mapping?: MouseMapping;
2286
+ maxLookDegrees?: number;
2262
2287
  pointerLock?: boolean;
2263
2288
  sensitivity?: number;
2264
2289
  }
@@ -2268,6 +2293,9 @@ export const MouseConfigSchema: _sinclair_typebox.TObject<{
2268
2293
  mapping: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TArray<_sinclair_typebox.TString>>>;
2269
2294
  pointerLock: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
2270
2295
  sensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
2296
+ lookMode: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"delta">, _sinclair_typebox.TLiteral<"screenCenter">]>>;
2297
+ maxLookDegrees: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
2298
+ lookSensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
2271
2299
  }>;
2272
2300
 
2273
2301
  // @public (undocumented)
@@ -2844,6 +2872,30 @@ export { RuntimeTriggerRegion2DOptions }
2844
2872
  // @public
2845
2873
  export type ScreenAnchor = 'top-left' | 'top-center' | 'top-right' | 'center-left' | 'center' | 'center-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
2846
2874
 
2875
+ // @public
2876
+ export function screenCenterLookDeltas(nx: number, ny: number, currentYaw: number, currentPitch: number, options?: ScreenCenterLookOptions): {
2877
+ lookX: number;
2878
+ lookY: number;
2879
+ };
2880
+
2881
+ // @public (undocumented)
2882
+ export interface ScreenCenterLookOptions {
2883
+ lookSensitivity?: number;
2884
+ // (undocumented)
2885
+ maxLookDegrees?: number;
2886
+ }
2887
+
2888
+ // @public
2889
+ export interface ScreenCenterLookTargets {
2890
+ // (undocumented)
2891
+ targetPitch: number;
2892
+ // (undocumented)
2893
+ targetYaw: number;
2894
+ }
2895
+
2896
+ // @public
2897
+ export function screenCenterLookTargets(nx: number, ny: number, maxDegrees?: number): ScreenCenterLookTargets;
2898
+
2847
2899
  export { ScreenVisibilityBehavior }
2848
2900
 
2849
2901
  export { ScreenVisibilityChangeContext }
@@ -2968,6 +3020,9 @@ export { Shooter2DStateComponent }
2968
3020
 
2969
3021
  export { Shooter2DTarget }
2970
3022
 
3023
+ // @public
3024
+ export function shortestAngleDelta(from: number, to: number): number;
3025
+
2971
3026
  export { Simulation }
2972
3027
 
2973
3028
  // Warning: (ae-forgotten-export) The symbol "PhysicsRenderPoseProvider" needs to be exported by the entry point public.d.ts
@@ -2998,6 +3053,8 @@ export class SimulationBody implements PhysicsRenderPoseProvider {
2998
3053
  isSleeping(): boolean;
2999
3054
  // (undocumented)
3000
3055
  linvel(): PhysicsVector3;
3056
+ lockRotations(locked: boolean, _wakeUp?: boolean): void;
3057
+ lockTranslations(locked: boolean, _wakeUp?: boolean): void;
3001
3058
  // (undocumented)
3002
3059
  mass(): number;
3003
3060
  // Warning: (ae-forgotten-export) The symbol "PhysicsQuaternion" needs to be exported by the entry point public.d.ts
@@ -3213,6 +3270,7 @@ export interface StageEntity extends Entity {
3213
3270
  mesh: Mesh;
3214
3271
  // (undocumented)
3215
3272
  name: string;
3273
+ skipRenderPoseSync?: boolean;
3216
3274
  // (undocumented)
3217
3275
  uuid: string;
3218
3276
  }
@@ -3614,6 +3672,12 @@ export function useMouseLook(player: InputPlayer, options?: {
3614
3672
  sensitivity?: number;
3615
3673
  }): GameInputConfig;
3616
3674
 
3675
+ // @public
3676
+ export function useScreenCenterLook(player: InputPlayer, options?: {
3677
+ maxLookDegrees?: number;
3678
+ lookSensitivity?: number;
3679
+ }): GameInputConfig;
3680
+
3617
3681
  // @public
3618
3682
  export function usesManagedRenderPath(options?: RenderCategoryOptions | null): boolean;
3619
3683
 
@@ -4528,16 +4592,16 @@ export class ZylemZone extends GameEntity<ZylemZoneOptions> implements Collision
4528
4592
 
4529
4593
  // Warnings were encountered during analysis:
4530
4594
  //
4531
- // dist/entity-BdSI8CL3.d.ts:406:5 - (ae-forgotten-export) The symbol "RenderCategory_2" needs to be exported by the entry point public.d.ts
4532
- // dist/entity-BdSI8CL3.d.ts:407:5 - (ae-forgotten-export) The symbol "RuntimeEntityOptions" needs to be exported by the entry point public.d.ts
4533
- // dist/entity-BdSI8CL3.d.ts:408:5 - (ae-forgotten-export) The symbol "CollisionOptions" needs to be exported by the entry point public.d.ts
4534
- // dist/entity-BdSI8CL3.d.ts:409:5 - (ae-forgotten-export) The symbol "MaterialOptions" needs to be exported by the entry point public.d.ts
4535
- // dist/entity-BdSI8CL3.d.ts:417:9 - (ae-forgotten-export) The symbol "IBuilder" needs to be exported by the entry point public.d.ts
4536
- // dist/entity-BdSI8CL3.d.ts:417:9 - (ae-forgotten-export) The symbol "EntityMeshBuilder" needs to be exported by the entry point public.d.ts
4537
- // dist/entity-BdSI8CL3.d.ts:418:9 - (ae-forgotten-export) The symbol "EntityCollisionBuilder" needs to be exported by the entry point public.d.ts
4538
- // dist/entity-BdSI8CL3.d.ts:419:9 - (ae-forgotten-export) The symbol "MaterialBuilder" needs to be exported by the entry point public.d.ts
4539
- // dist/game-C1FHVqXl.d.ts:908:5 - (ae-forgotten-export) The symbol "StageAssetLoaderConfig" needs to be exported by the entry point public.d.ts
4540
- // dist/game-C1FHVqXl.d.ts:1520:5 - (ae-forgotten-export) The symbol "StageInterface" needs to be exported by the entry point public.d.ts
4595
+ // dist/entity-BGEq1yfC.d.ts:423:5 - (ae-forgotten-export) The symbol "RenderCategory_2" needs to be exported by the entry point public.d.ts
4596
+ // dist/entity-BGEq1yfC.d.ts:424:5 - (ae-forgotten-export) The symbol "RuntimeEntityOptions" needs to be exported by the entry point public.d.ts
4597
+ // dist/entity-BGEq1yfC.d.ts:425:5 - (ae-forgotten-export) The symbol "CollisionOptions" needs to be exported by the entry point public.d.ts
4598
+ // dist/entity-BGEq1yfC.d.ts:426:5 - (ae-forgotten-export) The symbol "MaterialOptions" needs to be exported by the entry point public.d.ts
4599
+ // dist/entity-BGEq1yfC.d.ts:434:9 - (ae-forgotten-export) The symbol "IBuilder" needs to be exported by the entry point public.d.ts
4600
+ // dist/entity-BGEq1yfC.d.ts:434:9 - (ae-forgotten-export) The symbol "EntityMeshBuilder" needs to be exported by the entry point public.d.ts
4601
+ // dist/entity-BGEq1yfC.d.ts:435:9 - (ae-forgotten-export) The symbol "EntityCollisionBuilder" needs to be exported by the entry point public.d.ts
4602
+ // dist/entity-BGEq1yfC.d.ts:436:9 - (ae-forgotten-export) The symbol "MaterialBuilder" needs to be exported by the entry point public.d.ts
4603
+ // dist/game-DbqBQiFC.d.ts:937:5 - (ae-forgotten-export) The symbol "StageAssetLoaderConfig" needs to be exported by the entry point public.d.ts
4604
+ // dist/game-DbqBQiFC.d.ts:1549:5 - (ae-forgotten-export) The symbol "StageInterface" needs to be exported by the entry point public.d.ts
4541
4605
 
4542
4606
  // (No @packageDocumentation comment for this package)
4543
4607
 
@@ -518,6 +518,12 @@ declare interface BaseCollisionOptions {
518
518
  collisionType?: string;
519
519
  /** Allowed collision types for filtering */
520
520
  collisionFilter?: string[];
521
+ /** Gravity scale applied at body spawn (no live setter FFI; default 1). */
522
+ gravityScale?: number;
523
+ /** Lock rotation axes at body spawn: `true` for all, or per-axis tuple. */
524
+ lockRotations?: LockAxesInput;
525
+ /** Lock translation axes at body spawn: `true` for all, or per-axis tuple. */
526
+ lockTranslations?: LockAxesInput;
521
527
  }
522
528
 
523
529
  /**
@@ -801,6 +807,10 @@ export declare class CameraManager {
801
807
  private _activeCameras;
802
808
  /** Auto-created debug camera with orbit controls */
803
809
  private _debugCamera;
810
+ /** Gameplay primary camera saved while the debug camera is active. */
811
+ private _preDebugPrimary;
812
+ /** Scene anchor at world origin for debug orbit when nothing is selected. */
813
+ private _debugOrbitTargetAnchor;
804
814
  /** Reference to the shared renderer manager */
805
815
  private _rendererManager;
806
816
  /** Scene reference */
@@ -820,6 +830,10 @@ export declare class CameraManager {
820
830
  * Get the debug camera.
821
831
  */
822
832
  get debugCamera(): ZylemCamera | null;
833
+ /**
834
+ * Gameplay primary camera that was active before debug mode was enabled.
835
+ */
836
+ get preDebugPrimary(): ZylemCamera | null;
823
837
  /**
824
838
  * Get all registered cameras.
825
839
  */
@@ -863,6 +877,16 @@ export declare class CameraManager {
863
877
  * Also creates the debug camera.
864
878
  */
865
879
  setup(scene: Scene, rendererManager: RendererManager): Promise<void>;
880
+ /**
881
+ * Switch the primary viewport to the debug orbit camera, remembering the
882
+ * previous primary so gameplay cameras (e.g. first-person) can be restored.
883
+ */
884
+ activateDebugCamera(): boolean;
885
+ /**
886
+ * Restore the gameplay primary camera that was active before
887
+ * {@link activateDebugCamera}.
888
+ */
889
+ deactivateDebugCamera(): boolean;
866
890
  /**
867
891
  * Update all active cameras' controllers.
868
892
  */
@@ -884,8 +908,14 @@ export declare class CameraManager {
884
908
  dispose(): void;
885
909
  /**
886
910
  * Create the always-available debug camera with orbit controls.
911
+ * Registered for lookup/activation, but not added to the active list.
887
912
  */
888
913
  private createDebugCamera;
914
+ /**
915
+ * Seed the debug camera orbit pose on first activation, framing the origin
916
+ * or offsetting from the saved gameplay primary.
917
+ */
918
+ private seedDebugCameraPose;
889
919
  /**
890
920
  * Resolve a camera from a name or reference.
891
921
  */
@@ -1157,6 +1187,9 @@ export declare function clearGlobalSubscriptions(): void;
1157
1187
  declare class CollisionBuilder {
1158
1188
  static: boolean;
1159
1189
  sensor: boolean;
1190
+ gravityScale?: number;
1191
+ lockRotations?: LockAxesInput;
1192
+ lockTranslations?: LockAxesInput;
1160
1193
  build(options: Partial<CollisionOptions>): [SimulationBodyDefinition, SimulationColliderDefinition];
1161
1194
  withCollision(collisionOptions: Partial<CollisionOptions>): this;
1162
1195
  collider(options: CollisionOptions): SimulationColliderDefinition;
@@ -1214,6 +1247,12 @@ declare interface CollisionOptions {
1214
1247
  position?: Vec3Input;
1215
1248
  collisionType?: string;
1216
1249
  collisionFilter?: string[];
1250
+ /** Gravity scale applied at body spawn (no live setter FFI; default 1). */
1251
+ gravityScale?: number;
1252
+ /** Lock rotation axes at body spawn: `true` for all, or per-axis tuple. */
1253
+ lockRotations?: LockAxesInput;
1254
+ /** Lock translation axes at body spawn: `true` for all, or per-axis tuple. */
1255
+ lockTranslations?: LockAxesInput;
1217
1256
  }
1218
1257
 
1219
1258
  declare type CollisionPhase = 'enter' | 'stay';
@@ -1385,8 +1424,10 @@ export declare function createEntity<T extends GameEntity<any>, CreateOptions ex
1385
1424
  * const asteroidFactory = createEntityFactory(asteroidTemplate);
1386
1425
  * const asteroids = asteroidFactory.generate(10);
1387
1426
  *
1388
- * asteroids.forEach((asteroid, i) => {
1389
- * asteroid.setPosition(Math.random() * 20 - 10, Math.random() * 15 - 7.5, 0);
1427
+ * asteroids.forEach((asteroid) => {
1428
+ * asteroid.onSetup(({ me }) => {
1429
+ * me.setPosition(Math.random() * 20 - 10, Math.random() * 15 - 7.5, 0);
1430
+ * });
1390
1431
  * stage.add(asteroid);
1391
1432
  * });
1392
1433
  * ```
@@ -2188,6 +2229,8 @@ export declare class FirstPersonPerspective implements CameraPerspective {
2188
2229
  look(deltaYaw: number, deltaPitch: number): void;
2189
2230
  /** Set absolute yaw and pitch. Pitch is clamped to the configured limit. */
2190
2231
  setLook(yaw: number, pitch: number): void;
2232
+ /** Set eye height above the followed target (used when syncing from FirstPersonBehavior). */
2233
+ setEyeHeight(height: number): void;
2191
2234
  /** Current yaw in radians. */
2192
2235
  get yaw(): number;
2193
2236
  /** Current pitch in radians. */
@@ -2502,6 +2545,9 @@ export declare const GameConfigJsonSchema: _sinclair_typebox.TObject<{
2502
2545
  mapping: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TArray<_sinclair_typebox.TString>>>;
2503
2546
  pointerLock: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
2504
2547
  sensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
2548
+ lookMode: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"delta">, _sinclair_typebox.TLiteral<"screenCenter">]>>;
2549
+ maxLookDegrees: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
2550
+ lookSensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
2505
2551
  }>>;
2506
2552
  touch: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
2507
2553
  enabled: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TBoolean, _sinclair_typebox.TLiteral<"auto">]>>;
@@ -2709,6 +2755,14 @@ export declare class GameEntity<O extends GameEntityOptions> extends BaseNode<O>
2709
2755
  private trackAddedComponents;
2710
2756
  private trackedComponents;
2711
2757
  transformStore: TransformState;
2758
+ /** Hide render target until spawn placement is confirmed. */
2759
+ _spawnPlacementPending: boolean;
2760
+ /** Author passed `position` in create options. */
2761
+ _spawnPositionExplicit: boolean;
2762
+ /** setPosition / setPose assigned a spawn placement during this spawn. */
2763
+ _spawnPlacementReady: boolean;
2764
+ /** True while {@link StageEntityDelegate.spawnEntity} is running for this entity. */
2765
+ _spawnInProgress: boolean;
2712
2766
  moveX: (delta: number) => void;
2713
2767
  moveY: (delta: number) => void;
2714
2768
  moveZ: (delta: number) => void;
@@ -2741,6 +2795,9 @@ export declare class GameEntity<O extends GameEntityOptions> extends BaseNode<O>
2741
2795
  setRotation: (x: number, y: number, z: number) => void;
2742
2796
  getRotation: () => any;
2743
2797
  constructor();
2798
+ private wrapSpawnPlacementMutators;
2799
+ /** Make the entity visible, clearing spawn placement pending state. */
2800
+ reveal(): void;
2744
2801
  /**
2745
2802
  * Read the entity's pose from the wasm simulation. Returns `null` when
2746
2803
  * the entity has not been spawned into the runtime yet.
@@ -2896,6 +2953,17 @@ export declare type GameEntityOptions = {
2896
2953
  color?: Color;
2897
2954
  size?: Vec3Input;
2898
2955
  position?: Vec3Input;
2956
+ /**
2957
+ * Spawn visibility behavior:
2958
+ * - `undefined` (default): hidden while `spawnEntity` runs, revealed once
2959
+ * the spawn finalizes — even if no position was assigned.
2960
+ * - `true` (strict): stays hidden until the first `setPosition`/`setPose`,
2961
+ * for spawner patterns that place the entity frames after spawn.
2962
+ * - `false`: never hidden during spawn.
2963
+ */
2964
+ hideUntilPositioned?: boolean;
2965
+ /** Explicit render visibility. When false, entity stays hidden until {@link GameEntity.reveal}. */
2966
+ visible?: boolean;
2899
2967
  /** Render path: `environment` (bundle), `pack` (instanced), or `none` (default). */
2900
2968
  category?: RenderCategory_2;
2901
2969
  runtime?: RuntimeEntityOptions;
@@ -2953,6 +3021,9 @@ export declare const GameInputConfigSchema: _sinclair_typebox.TRecord<_sinclair_
2953
3021
  mapping: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TArray<_sinclair_typebox.TString>>>;
2954
3022
  pointerLock: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
2955
3023
  sensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
3024
+ lookMode: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"delta">, _sinclair_typebox.TLiteral<"screenCenter">]>>;
3025
+ maxLookDegrees: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
3026
+ lookSensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
2956
3027
  }>>;
2957
3028
  touch: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
2958
3029
  enabled: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TBoolean, _sinclair_typebox.TLiteral<"auto">]>>;
@@ -3041,6 +3112,9 @@ export declare const GameInputPlayerConfigSchema: _sinclair_typebox.TObject<{
3041
3112
  mapping: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TArray<_sinclair_typebox.TString>>>;
3042
3113
  pointerLock: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
3043
3114
  sensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
3115
+ lookMode: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"delta">, _sinclair_typebox.TLiteral<"screenCenter">]>>;
3116
+ maxLookDegrees: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
3117
+ lookSensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
3044
3118
  }>>;
3045
3119
  touch: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
3046
3120
  enabled: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TBoolean, _sinclair_typebox.TLiteral<"auto">]>>;
@@ -3297,8 +3371,14 @@ export declare interface InputGamepad {
3297
3371
  };
3298
3372
  /** Screen-space cursor position (normalized 0..1). Only populated by MouseProvider. */
3299
3373
  pointer?: {
3374
+ /** Window-normalized X (0 = left, 1 = right). */
3300
3375
  x: number;
3376
+ /** Window-normalized Y (0 = top, 1 = bottom). */
3301
3377
  y: number;
3378
+ /** Canvas-center-relative X (−1 = left edge, +1 = right edge). */
3379
+ centerX: number;
3380
+ /** Canvas-center-relative Y (−1 = top edge, +1 = bottom edge). */
3381
+ centerY: number;
3302
3382
  };
3303
3383
  }
3304
3384
 
@@ -3590,6 +3670,9 @@ export declare type LoadingEvent = {
3590
3670
  current?: number;
3591
3671
  };
3592
3672
 
3673
+ /** Per-axis lock input: `true` locks all axes, or pass an [x, y, z] tuple. */
3674
+ declare type LockAxesInput = boolean | readonly [boolean, boolean, boolean];
3675
+
3593
3676
  declare class MaterialBuilder {
3594
3677
  static sharedMaterialMap: Map<MaterialCacheKey, SharedMaterialMapEntry>;
3595
3678
  /**
@@ -3688,6 +3771,12 @@ export declare interface MouseConfig {
3688
3771
  pointerLock?: boolean;
3689
3772
  /** Sensitivity multiplier for mouse movement (default 0.002). */
3690
3773
  sensitivity?: number;
3774
+ /** How mouse position drives look: delta (movement) or screenCenter (cursor offset from viewport center). */
3775
+ lookMode?: 'delta' | 'screenCenter';
3776
+ /** Max yaw/pitch in degrees when `lookMode` is `screenCenter` (default 45). */
3777
+ maxLookDegrees?: number;
3778
+ /** Screen-center follow rate toward cursor-mapped target (lower = snappier; default 2). */
3779
+ lookSensitivity?: number;
3691
3780
  }
3692
3781
 
3693
3782
  /** Mouse input configuration. */
@@ -3695,6 +3784,9 @@ export declare const MouseConfigSchema: _sinclair_typebox.TObject<{
3695
3784
  mapping: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TArray<_sinclair_typebox.TString>>>;
3696
3785
  pointerLock: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
3697
3786
  sensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
3787
+ lookMode: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"delta">, _sinclair_typebox.TLiteral<"screenCenter">]>>;
3788
+ maxLookDegrees: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
3789
+ lookSensitivity: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
3698
3790
  }>;
3699
3791
 
3700
3792
  export declare type MouseMapping = Record<string, string[]>;
@@ -4832,6 +4924,41 @@ declare interface SceneState {
4832
4924
  */
4833
4925
  export declare type ScreenAnchor = 'top-left' | 'top-center' | 'top-right' | 'center-left' | 'center' | 'center-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
4834
4926
 
4927
+ /**
4928
+ * Computes WASM look deltas that drive current yaw/pitch toward screen-center targets.
4929
+ *
4930
+ * `lookSensitivity` controls follow rate toward the cursor-mapped target (lower = snappier).
4931
+ * WASM applies its own `look_sensitivity` multiplier to these deltas.
4932
+ */
4933
+ export declare function screenCenterLookDeltas(nx: number, ny: number, currentYaw: number, currentPitch: number, options?: ScreenCenterLookOptions): {
4934
+ lookX: number;
4935
+ lookY: number;
4936
+ };
4937
+
4938
+ export declare interface ScreenCenterLookOptions {
4939
+ maxLookDegrees?: number;
4940
+ /** How fast cursor position pulls yaw/pitch toward target (lower = snappier). @default 2 */
4941
+ lookSensitivity?: number;
4942
+ }
4943
+
4944
+ /**
4945
+ * Maps canvas-center-relative pointer offset to absolute yaw/pitch targets.
4946
+ * Used with screen-center mouse look (free cursor, no pointer lock).
4947
+ */
4948
+ export declare interface ScreenCenterLookTargets {
4949
+ targetYaw: number;
4950
+ targetPitch: number;
4951
+ }
4952
+
4953
+ /**
4954
+ * Converts normalized pointer offset from viewport center to look angles.
4955
+ *
4956
+ * @param nx Horizontal offset from center (−1 = left edge, +1 = right edge).
4957
+ * @param ny Vertical offset from center (−1 = top edge, +1 = bottom edge).
4958
+ * @param maxDegrees Maximum yaw/pitch at viewport edges (default 45).
4959
+ */
4960
+ export declare function screenCenterLookTargets(nx: number, ny: number, maxDegrees?: number): ScreenCenterLookTargets;
4961
+
4835
4962
  export { ScreenVisibilityBehavior }
4836
4963
 
4837
4964
  export { ScreenVisibilityChangeContext }
@@ -5023,6 +5150,9 @@ export { Shooter2DStateComponent }
5023
5150
 
5024
5151
  export { Shooter2DTarget }
5025
5152
 
5153
+ /** Shortest signed angle from `from` to `to` in radians. */
5154
+ export declare function shortestAngleDelta(from: number, to: number): number;
5155
+
5026
5156
  declare function shortHash(objString: string): string;
5027
5157
 
5028
5158
  export { Simulation }
@@ -5034,7 +5164,19 @@ export declare class SimulationBody implements PhysicsRenderPoseProvider {
5034
5164
  private readonly poseScratch;
5035
5165
  private readonly renderScratch;
5036
5166
  private readonly previousScratch;
5167
+ /**
5168
+ * First step at which the shared render buffers are coherent for this
5169
+ * body. After a spawn or an explicit pose write (teleport), the current
5170
+ * slot isn't written until the next fixed step and the previous-step
5171
+ * copy lags one more; interpolating across that gap would sweep the
5172
+ * mesh from a stale pose (often the origin). Until this step is
5173
+ * reached, render reads collapse to the live body pose.
5174
+ */
5175
+ private interpolationValidAfterStep;
5037
5176
  constructor(simulation: Simulation, handle: EntityHandle, clock: SimulationStepClock);
5177
+ /** Suppress interpolation until the render buffers catch up. */
5178
+ private markPoseDiscontinuity;
5179
+ private isInterpolationStale;
5038
5180
  translation(): PhysicsVector3;
5039
5181
  rotation(): PhysicsQuaternion;
5040
5182
  linvel(): PhysicsVector3;
@@ -5044,6 +5186,22 @@ export declare class SimulationBody implements PhysicsRenderPoseProvider {
5044
5186
  setLinvel(velocity: PhysicsVector3, _wakeUp?: boolean): void;
5045
5187
  setAngvel(velocity: PhysicsVector3, _wakeUp?: boolean): void;
5046
5188
  applyImpulse(impulse: PhysicsVector3, _wakeUp?: boolean): void;
5189
+ /**
5190
+ * Rotation locks are fixed at body-creation time in the wasm runtime
5191
+ * (`SimulationBodyDefinition.lockRotation`); there is no live setter FFI
5192
+ * yet. Accepted for Rapier compat — when locking, the angular velocity is
5193
+ * zeroed to approximate the intent. Prefer lock flags on the body
5194
+ * definition at spawn time.
5195
+ */
5196
+ lockRotations(locked: boolean, _wakeUp?: boolean): void;
5197
+ /**
5198
+ * Translation locks are fixed at body-creation time in the wasm runtime
5199
+ * (`SimulationBodyDefinition.lockTranslation`); there is no live setter
5200
+ * FFI yet. Accepted for Rapier compat — when locking, the linear velocity
5201
+ * is zeroed to approximate the intent. Prefer lock flags on the body
5202
+ * definition at spawn time.
5203
+ */
5204
+ lockTranslations(locked: boolean, _wakeUp?: boolean): void;
5047
5205
  /**
5048
5206
  * Damping is fixed at body-creation time in the wasm runtime; there is no
5049
5207
  * live setter FFI yet, so this is accepted (for `MoveableBodyLike`
@@ -5377,15 +5535,18 @@ declare class StageDebugDelegate {
5377
5535
  private debugStateUnsubscribe;
5378
5536
  private focusContextUnregister;
5379
5537
  constructor(stage: ZylemStage, options?: StageDebugDelegateOptions);
5538
+ /** Camera used for debug orbit / raycasts (active primary, usually `__debug__`). */
5539
+ private getDebugViewCamera;
5380
5540
  private resolveEntity;
5381
5541
  /** Copy all stage children into debugMap so raycast/select tools work after enabling debug mid-session. */
5382
5542
  private populateDebugMap;
5383
5543
  private ensureCameraDebugDelegate;
5384
5544
  private syncWithDebugState;
5385
- /** Initialize DOM listeners and camera debug delegate when debug is turned on. */
5545
+ /** Initialize DOM listeners and switch rendering to the debug orbit camera. */
5386
5546
  private activate;
5387
- /** Tear down visuals and camera debug delegate when debug is turned off. */
5547
+ /** Tear down visuals and restore the gameplay primary camera. */
5388
5548
  private deactivate;
5549
+ private rebindPostProcessing;
5389
5550
  private initDebugVisuals;
5390
5551
  private disposeDebugVisuals;
5391
5552
  update(): void;
@@ -5410,6 +5571,12 @@ export declare interface StageEntity extends Entity {
5410
5571
  instanceId: number;
5411
5572
  isInstanced?: boolean;
5412
5573
  isBundled?: boolean;
5574
+ /**
5575
+ * When true, `syncRenderPoses` leaves the entity's Three.js transform alone.
5576
+ * Used for camera-parented viewmodels so physics pose sync cannot overwrite
5577
+ * the local offset.
5578
+ */
5579
+ skipRenderPoseSync?: boolean;
5413
5580
  controlledRotation: boolean;
5414
5581
  name: string;
5415
5582
  markedForRemoval: boolean;
@@ -6355,6 +6522,16 @@ export declare function useMouseLook(player: InputPlayer, options?: {
6355
6522
  sensitivity?: number;
6356
6523
  }): GameInputConfig;
6357
6524
 
6525
+ /**
6526
+ * Enables screen-center mouse look (free cursor, no pointer lock).
6527
+ * Cursor offset from the game canvas center maps to yaw/pitch up to `maxLookDegrees`.
6528
+ * @example stage.setInputConfiguration(useScreenCenterLook('p1'));
6529
+ */
6530
+ export declare function useScreenCenterLook(player: InputPlayer, options?: {
6531
+ maxLookDegrees?: number;
6532
+ lookSensitivity?: number;
6533
+ }): GameInputConfig;
6534
+
6358
6535
  /** Whether the entity opts into a managed render path (bundle or instanced). */
6359
6536
  export declare function usesManagedRenderPath(options?: RenderCategoryOptions | null): boolean;
6360
6537
 
@@ -6961,6 +7138,8 @@ declare class ZylemCamera {
6961
7138
  private _useOrbitalControls;
6962
7139
  /** When true, debug-mode orbital controls are not attached to this camera. */
6963
7140
  _skipDebugOrbit: boolean;
7141
+ /** Dedicated debug-view camera (e.g. `__debug__`); uses simplified orbit path. */
7142
+ isDebugViewCamera: boolean;
6964
7143
  /** Reference to the shared renderer manager (set during setup). */
6965
7144
  private _rendererManager;
6966
7145
  /** Elapsed time tracker for CameraContext. */
@@ -7047,6 +7226,16 @@ declare class ZylemCamera {
7047
7226
  * Dispose camera resources.
7048
7227
  */
7049
7228
  destroy(): void;
7229
+ /**
7230
+ * Set the default orbit target for debug mode (e.g. origin anchor).
7231
+ */
7232
+ setDefaultOrbitTarget(target: Object3D): void;
7233
+ /**
7234
+ * Seed the debug orbit camera to an initial pose.
7235
+ */
7236
+ seedDebugOrbitPose(position: Vector3, lookAt: Vector3): void;
7237
+ /** Whether the debug orbit camera has received its initial pose. */
7238
+ isDebugOrbitPoseSeeded(): boolean;
7050
7239
  /**
7051
7240
  * Attach a delegate to react to debug state changes.
7052
7241
  * Skipped when _skipDebugOrbit is true so the pipeline always runs.