@relu-interactives/spatial-ecs 0.3.1 → 0.3.4

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 (39) hide show
  1. package/dist/{XRRig-Cu-EyliG.d.cts → XRRig-2686IqLQ.d.cts} +5 -5
  2. package/dist/{XRRig-CAmf04NX.d.ts → XRRig-D2QURXl1.d.ts} +5 -5
  3. package/dist/{chunk-67WGASUJ.js → chunk-2LVFGVWI.js} +3 -3
  4. package/dist/{chunk-67WGASUJ.js.map → chunk-2LVFGVWI.js.map} +1 -1
  5. package/dist/{chunk-PCOZLCXS.js → chunk-4BZYK3JP.js} +14 -6
  6. package/dist/chunk-4BZYK3JP.js.map +1 -0
  7. package/dist/{chunk-U3MDYKPV.js → chunk-6QC2PJLD.js} +4 -3
  8. package/dist/chunk-6QC2PJLD.js.map +1 -0
  9. package/dist/{chunk-VXUVNC7S.js → chunk-ID266ZUA.js} +199 -5
  10. package/dist/chunk-ID266ZUA.js.map +1 -0
  11. package/dist/components/index.cjs +2 -1
  12. package/dist/components/index.cjs.map +1 -1
  13. package/dist/components/index.d.cts +2 -2
  14. package/dist/components/index.d.ts +2 -2
  15. package/dist/components/index.js +1 -1
  16. package/dist/factories/index.cjs +12 -3
  17. package/dist/factories/index.cjs.map +1 -1
  18. package/dist/factories/index.d.cts +1 -1
  19. package/dist/factories/index.d.ts +1 -1
  20. package/dist/factories/index.js +3 -3
  21. package/dist/{index-YYypJaVw.d.cts → index-Bc0YCz1A.d.cts} +27 -1
  22. package/dist/{index-w1oqWl_M.d.ts → index-BtKOaHfY.d.ts} +1 -1
  23. package/dist/{index-D84o_UA6.d.ts → index-CRmfSYdj.d.ts} +27 -1
  24. package/dist/{index-CUFd71ri.d.cts → index-Xu238jLn.d.cts} +1 -1
  25. package/dist/index.cjs +210 -3
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +8 -5
  28. package/dist/index.d.ts +8 -5
  29. package/dist/index.js +10 -8
  30. package/dist/index.js.map +1 -1
  31. package/dist/systems/index.cjs +198 -1
  32. package/dist/systems/index.cjs.map +1 -1
  33. package/dist/systems/index.d.cts +1 -1
  34. package/dist/systems/index.d.ts +1 -1
  35. package/dist/systems/index.js +3 -3
  36. package/package.json +1 -1
  37. package/dist/chunk-PCOZLCXS.js.map +0 -1
  38. package/dist/chunk-U3MDYKPV.js.map +0 -1
  39. package/dist/chunk-VXUVNC7S.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { A as AnimationComponent, b as AudioComponent, c as CameraComponentOptions, C as CameraComponent, S as RigidbodyState, g as ColliderState, P as PhysicsComponent, n as EntityType, I as ImageComponent, p as ImageTargetAnchor, o as ImageTarget, L as LightComponent, M as MaterialComponent, z as MeshComponent, B as MeshGeometryComponent, H as ModelComponent, N as Name, O as Object3DRef, V as ScriptEntry, U as ScriptComponent, X as ScriptObjectComponentInput, W as ScriptObjectComponent, Z as Selectable, _ as SelectionTransformState, $ as SpriteComponent, v as InstancedMeshKind, F as MeshGeometryParameters, u as InstancedMeshComponent, s as InstanceSlotComponent, a5 as VideoComponent, a9 as XRRigComponent, a3 as VRTeleportAreaComponent, a7 as XRInteractableComponent } from '../XRRig-Cu-EyliG.cjs';
1
+ import { A as AnimationComponent, b as AudioComponent, c as CameraComponentOptions, C as CameraComponent, S as RigidbodyState, g as ColliderState, P as PhysicsComponent, n as EntityType, I as ImageComponent, p as ImageTargetAnchor, o as ImageTarget, L as LightComponent, M as MaterialComponent, z as MeshComponent, B as MeshGeometryComponent, H as ModelComponent, N as Name, O as Object3DRef, V as ScriptEntry, U as ScriptComponent, X as ScriptObjectComponentInput, W as ScriptObjectComponent, Z as Selectable, _ as SelectionTransformState, $ as SpriteComponent, v as InstancedMeshKind, F as MeshGeometryParameters, u as InstancedMeshComponent, s as InstanceSlotComponent, a5 as VideoComponent, a9 as XRRigComponent, a3 as VRTeleportAreaComponent, a7 as XRInteractableComponent } from '../XRRig-2686IqLQ.cjs';
2
2
  import { l as World, g as EnvironmentState, E as Environment, P as ParentId, i as PostprocessingState, h as Postprocessing, T as TransformComponent, O as ObjectManagementSystem } from '../System-vrU46Vuw.cjs';
3
3
  import * as THREE from 'three';
4
4
  import '@dimforge/rapier3d-compat';
@@ -1,4 +1,4 @@
1
- import { A as AnimationComponent, b as AudioComponent, c as CameraComponentOptions, C as CameraComponent, S as RigidbodyState, g as ColliderState, P as PhysicsComponent, n as EntityType, I as ImageComponent, p as ImageTargetAnchor, o as ImageTarget, L as LightComponent, M as MaterialComponent, z as MeshComponent, B as MeshGeometryComponent, H as ModelComponent, N as Name, O as Object3DRef, V as ScriptEntry, U as ScriptComponent, X as ScriptObjectComponentInput, W as ScriptObjectComponent, Z as Selectable, _ as SelectionTransformState, $ as SpriteComponent, v as InstancedMeshKind, F as MeshGeometryParameters, u as InstancedMeshComponent, s as InstanceSlotComponent, a5 as VideoComponent, a9 as XRRigComponent, a3 as VRTeleportAreaComponent, a7 as XRInteractableComponent } from '../XRRig-CAmf04NX.js';
1
+ import { A as AnimationComponent, b as AudioComponent, c as CameraComponentOptions, C as CameraComponent, S as RigidbodyState, g as ColliderState, P as PhysicsComponent, n as EntityType, I as ImageComponent, p as ImageTargetAnchor, o as ImageTarget, L as LightComponent, M as MaterialComponent, z as MeshComponent, B as MeshGeometryComponent, H as ModelComponent, N as Name, O as Object3DRef, V as ScriptEntry, U as ScriptComponent, X as ScriptObjectComponentInput, W as ScriptObjectComponent, Z as Selectable, _ as SelectionTransformState, $ as SpriteComponent, v as InstancedMeshKind, F as MeshGeometryParameters, u as InstancedMeshComponent, s as InstanceSlotComponent, a5 as VideoComponent, a9 as XRRigComponent, a3 as VRTeleportAreaComponent, a7 as XRInteractableComponent } from '../XRRig-D2QURXl1.js';
2
2
  import { l as World, g as EnvironmentState, E as Environment, P as ParentId, i as PostprocessingState, h as Postprocessing, T as TransformComponent, O as ObjectManagementSystem } from '../System-vrU46Vuw.js';
3
3
  import * as THREE from 'three';
4
4
  import '@dimforge/rapier3d-compat';
@@ -1,6 +1,6 @@
1
- export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstanceSlotComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createScriptObjectComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVRTeleportAreaComponent, createVideoComponent, createXRInteractableComponent, createXRRigComponent, registerDefaultComponentFactories, registerDefaultFactories } from '../chunk-PCOZLCXS.js';
2
- import '../chunk-67WGASUJ.js';
3
- import '../chunk-U3MDYKPV.js';
1
+ export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstanceSlotComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createScriptObjectComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVRTeleportAreaComponent, createVideoComponent, createXRInteractableComponent, createXRRigComponent, registerDefaultComponentFactories, registerDefaultFactories } from '../chunk-4BZYK3JP.js';
2
+ import '../chunk-2LVFGVWI.js';
3
+ import '../chunk-6QC2PJLD.js';
4
4
  import '../chunk-OY7ZODZP.js';
5
5
  //# sourceMappingURL=index.js.map
6
6
  //# sourceMappingURL=index.js.map
@@ -485,4 +485,30 @@ declare class XRSessionSystem implements EcsSystem {
485
485
  getInputs(): XrInputState[];
486
486
  }
487
487
 
488
- export { AnimationSystem as A, CameraSyncSystem as C, EnvironmentSyncSystem as E, InstancedMeshSystem as I, LightSyncSystem as L, MaterialSyncSystem as M, NO_XR_CAPABILITIES as N, ObjectVisibilitySystem as O, PhysicsSyncSystem as P, SCRIPT_OBJECT_ROOT_FLAG as S, VideoSystem as V, type XrCapabilities as X, type XrInputState as a, AudioSystem as b, MeshGeometrySystem as c, type ModuleLoader as d, PostprocessingSyncSystem as e, ScriptBehaviourSystem as f, ScriptObjectSystem as g, type SelectionContext as h, XRInputSystem as i, XRInteractionSystem as j, XRLocomotionSystem as k, XRSessionSystem as l, type XrHandedness as m, type XrInputKind as n, readXrCapabilities as r };
488
+ declare class VRTeleportAreaSystem implements EcsSystem {
489
+ private readonly signatures;
490
+ update(world: World): void;
491
+ }
492
+
493
+ declare class XRControllerVisualSystem implements EcsSystem {
494
+ private readonly controllerModelFactory;
495
+ private readonly handModelFactory;
496
+ private readonly group;
497
+ private built;
498
+ private attachedTo;
499
+ /** Index → whether we've already attached visuals for that slot. */
500
+ private readonly ready;
501
+ /** How many controller slots to wire. Two covers every current headset. */
502
+ private readonly slots;
503
+ constructor(slots?: number);
504
+ update(world: World): void;
505
+ /**
506
+ * Parent the visuals to the XR rig when there is one, so locomotion moves the
507
+ * hands with the player. Falls back to the scene root.
508
+ */
509
+ private ensureAttached;
510
+ private createRay;
511
+ dispose(): void;
512
+ }
513
+
514
+ export { AnimationSystem as A, CameraSyncSystem as C, EnvironmentSyncSystem as E, InstancedMeshSystem as I, LightSyncSystem as L, MaterialSyncSystem as M, NO_XR_CAPABILITIES as N, ObjectVisibilitySystem as O, PhysicsSyncSystem as P, SCRIPT_OBJECT_ROOT_FLAG as S, VRTeleportAreaSystem as V, type XrCapabilities as X, type XrInputState as a, AudioSystem as b, MeshGeometrySystem as c, type ModuleLoader as d, PostprocessingSyncSystem as e, ScriptBehaviourSystem as f, ScriptObjectSystem as g, type SelectionContext as h, VideoSystem as i, XRControllerVisualSystem as j, XRInputSystem as k, XRInteractionSystem as l, XRLocomotionSystem as m, XRSessionSystem as n, type XrHandedness as o, type XrInputKind as p, readXrCapabilities as r };
@@ -1,4 +1,4 @@
1
- import { A as AnimationComponent, a as AnimationComponentOptions, b as AudioComponent, C as CameraComponent, c as CameraComponentOptions, d as CameraProjection, e as CameraRuntimeType, f as ColliderShape, g as ColliderState, h as CubeMeshParameters, D as DEFAULT_COLLIDER_STATE, i as DEFAULT_INSTANCED_MESH_PARAMETERS, j as DEFAULT_INSTANCE_TRANSFORM, k as DEFAULT_MESH_GEOMETRY_PARAMETERS, l as DEFAULT_PHYSICS_STATE, m as DEFAULT_RIGIDBODY_STATE, E as EditableMeshObjectKind, n as EntityType, I as ImageComponent, o as ImageTarget, p as ImageTargetAnchor, q as ImageTargetAnchorOptions, r as ImageTargetReference, s as InstanceSlotComponent, t as InstanceTransform, u as InstancedMeshComponent, v as InstancedMeshKind, L as LightComponent, w as LightValueState, M as MaterialComponent, x as MaterialTypeValue, y as MaterialValueState, z as MeshComponent, B as MeshGeometryComponent, F as MeshGeometryParameters, G as MeshGeometryParametersByKind, H as ModelComponent, N as Name, O as Object3DRef, P as PhysicsComponent, J as PhysicsState, K as PlaneMeshParameters, R as RadiusHeightMeshParameters, Q as RadiusMeshParameters, S as RigidbodyState, T as RigidbodyType, U as ScriptComponent, V as ScriptEntry, W as ScriptObjectComponent, X as ScriptObjectComponentInput, Y as ScriptObjectRuntimeState, Z as Selectable, _ as SelectionTransformState, $ as SpriteComponent, a0 as TextureFilteringValue, a1 as TransformModeValue, a2 as TransformSpaceValue, a3 as VRTeleportAreaComponent, a4 as VRTeleportAreaOptions, a5 as VideoComponent, a6 as VrTeleportShape, a7 as XRInteractableComponent, a8 as XRInteractableOptions, a9 as XRRigComponent, aa as XRRigOptions, ab as XrGrabMode, ac as XrLocomotionMode, ad as defaultMaterialValue, ae as normalizePhysicsState, af as setPhysicsLiveRef } from './XRRig-CAmf04NX.js';
1
+ import { A as AnimationComponent, a as AnimationComponentOptions, b as AudioComponent, C as CameraComponent, c as CameraComponentOptions, d as CameraProjection, e as CameraRuntimeType, f as ColliderShape, g as ColliderState, h as CubeMeshParameters, D as DEFAULT_COLLIDER_STATE, i as DEFAULT_INSTANCED_MESH_PARAMETERS, j as DEFAULT_INSTANCE_TRANSFORM, k as DEFAULT_MESH_GEOMETRY_PARAMETERS, l as DEFAULT_PHYSICS_STATE, m as DEFAULT_RIGIDBODY_STATE, E as EditableMeshObjectKind, n as EntityType, I as ImageComponent, o as ImageTarget, p as ImageTargetAnchor, q as ImageTargetAnchorOptions, r as ImageTargetReference, s as InstanceSlotComponent, t as InstanceTransform, u as InstancedMeshComponent, v as InstancedMeshKind, L as LightComponent, w as LightValueState, M as MaterialComponent, x as MaterialTypeValue, y as MaterialValueState, z as MeshComponent, B as MeshGeometryComponent, F as MeshGeometryParameters, G as MeshGeometryParametersByKind, H as ModelComponent, N as Name, O as Object3DRef, P as PhysicsComponent, J as PhysicsState, K as PlaneMeshParameters, R as RadiusHeightMeshParameters, Q as RadiusMeshParameters, S as RigidbodyState, T as RigidbodyType, U as ScriptComponent, V as ScriptEntry, W as ScriptObjectComponent, X as ScriptObjectComponentInput, Y as ScriptObjectRuntimeState, Z as Selectable, _ as SelectionTransformState, $ as SpriteComponent, a0 as TextureFilteringValue, a1 as TransformModeValue, a2 as TransformSpaceValue, a3 as VRTeleportAreaComponent, a4 as VRTeleportAreaOptions, a5 as VideoComponent, a6 as VrTeleportShape, a7 as XRInteractableComponent, a8 as XRInteractableOptions, a9 as XRRigComponent, aa as XRRigOptions, ab as XrGrabMode, ac as XrLocomotionMode, ad as defaultMaterialValue, ae as normalizePhysicsState, af as setPhysicsLiveRef } from './XRRig-D2QURXl1.js';
2
2
  import { C as Component, D as DEFAULT_ENVIRONMENT_STATE, a as DEFAULT_POSTPROCESSING_STATE, E as Environment, b as EnvironmentFogState, c as EnvironmentFogType, d as EnvironmentGradientEffect, e as EnvironmentSkyboxState, f as EnvironmentSkyboxType, g as EnvironmentState, P as ParentId, h as Postprocessing, i as PostprocessingState, T as TransformComponent, j as TransformData, V as Vec3 } from './System-vrU46Vuw.js';
3
3
 
4
4
  /**
@@ -485,4 +485,30 @@ declare class XRSessionSystem implements EcsSystem {
485
485
  getInputs(): XrInputState[];
486
486
  }
487
487
 
488
- export { AnimationSystem as A, CameraSyncSystem as C, EnvironmentSyncSystem as E, InstancedMeshSystem as I, LightSyncSystem as L, MaterialSyncSystem as M, NO_XR_CAPABILITIES as N, ObjectVisibilitySystem as O, PhysicsSyncSystem as P, SCRIPT_OBJECT_ROOT_FLAG as S, VideoSystem as V, type XrCapabilities as X, type XrInputState as a, AudioSystem as b, MeshGeometrySystem as c, type ModuleLoader as d, PostprocessingSyncSystem as e, ScriptBehaviourSystem as f, ScriptObjectSystem as g, type SelectionContext as h, XRInputSystem as i, XRInteractionSystem as j, XRLocomotionSystem as k, XRSessionSystem as l, type XrHandedness as m, type XrInputKind as n, readXrCapabilities as r };
488
+ declare class VRTeleportAreaSystem implements EcsSystem {
489
+ private readonly signatures;
490
+ update(world: World): void;
491
+ }
492
+
493
+ declare class XRControllerVisualSystem implements EcsSystem {
494
+ private readonly controllerModelFactory;
495
+ private readonly handModelFactory;
496
+ private readonly group;
497
+ private built;
498
+ private attachedTo;
499
+ /** Index → whether we've already attached visuals for that slot. */
500
+ private readonly ready;
501
+ /** How many controller slots to wire. Two covers every current headset. */
502
+ private readonly slots;
503
+ constructor(slots?: number);
504
+ update(world: World): void;
505
+ /**
506
+ * Parent the visuals to the XR rig when there is one, so locomotion moves the
507
+ * hands with the player. Falls back to the scene root.
508
+ */
509
+ private ensureAttached;
510
+ private createRay;
511
+ dispose(): void;
512
+ }
513
+
514
+ export { AnimationSystem as A, CameraSyncSystem as C, EnvironmentSyncSystem as E, InstancedMeshSystem as I, LightSyncSystem as L, MaterialSyncSystem as M, NO_XR_CAPABILITIES as N, ObjectVisibilitySystem as O, PhysicsSyncSystem as P, SCRIPT_OBJECT_ROOT_FLAG as S, VRTeleportAreaSystem as V, type XrCapabilities as X, type XrInputState as a, AudioSystem as b, MeshGeometrySystem as c, type ModuleLoader as d, PostprocessingSyncSystem as e, ScriptBehaviourSystem as f, ScriptObjectSystem as g, type SelectionContext as h, VideoSystem as i, XRControllerVisualSystem as j, XRInputSystem as k, XRInteractionSystem as l, XRLocomotionSystem as m, XRSessionSystem as n, type XrHandedness as o, type XrInputKind as p, readXrCapabilities as r };
@@ -1,4 +1,4 @@
1
- import { A as AnimationComponent, a as AnimationComponentOptions, b as AudioComponent, C as CameraComponent, c as CameraComponentOptions, d as CameraProjection, e as CameraRuntimeType, f as ColliderShape, g as ColliderState, h as CubeMeshParameters, D as DEFAULT_COLLIDER_STATE, i as DEFAULT_INSTANCED_MESH_PARAMETERS, j as DEFAULT_INSTANCE_TRANSFORM, k as DEFAULT_MESH_GEOMETRY_PARAMETERS, l as DEFAULT_PHYSICS_STATE, m as DEFAULT_RIGIDBODY_STATE, E as EditableMeshObjectKind, n as EntityType, I as ImageComponent, o as ImageTarget, p as ImageTargetAnchor, q as ImageTargetAnchorOptions, r as ImageTargetReference, s as InstanceSlotComponent, t as InstanceTransform, u as InstancedMeshComponent, v as InstancedMeshKind, L as LightComponent, w as LightValueState, M as MaterialComponent, x as MaterialTypeValue, y as MaterialValueState, z as MeshComponent, B as MeshGeometryComponent, F as MeshGeometryParameters, G as MeshGeometryParametersByKind, H as ModelComponent, N as Name, O as Object3DRef, P as PhysicsComponent, J as PhysicsState, K as PlaneMeshParameters, R as RadiusHeightMeshParameters, Q as RadiusMeshParameters, S as RigidbodyState, T as RigidbodyType, U as ScriptComponent, V as ScriptEntry, W as ScriptObjectComponent, X as ScriptObjectComponentInput, Y as ScriptObjectRuntimeState, Z as Selectable, _ as SelectionTransformState, $ as SpriteComponent, a0 as TextureFilteringValue, a1 as TransformModeValue, a2 as TransformSpaceValue, a3 as VRTeleportAreaComponent, a4 as VRTeleportAreaOptions, a5 as VideoComponent, a6 as VrTeleportShape, a7 as XRInteractableComponent, a8 as XRInteractableOptions, a9 as XRRigComponent, aa as XRRigOptions, ab as XrGrabMode, ac as XrLocomotionMode, ad as defaultMaterialValue, ae as normalizePhysicsState, af as setPhysicsLiveRef } from './XRRig-Cu-EyliG.cjs';
1
+ import { A as AnimationComponent, a as AnimationComponentOptions, b as AudioComponent, C as CameraComponent, c as CameraComponentOptions, d as CameraProjection, e as CameraRuntimeType, f as ColliderShape, g as ColliderState, h as CubeMeshParameters, D as DEFAULT_COLLIDER_STATE, i as DEFAULT_INSTANCED_MESH_PARAMETERS, j as DEFAULT_INSTANCE_TRANSFORM, k as DEFAULT_MESH_GEOMETRY_PARAMETERS, l as DEFAULT_PHYSICS_STATE, m as DEFAULT_RIGIDBODY_STATE, E as EditableMeshObjectKind, n as EntityType, I as ImageComponent, o as ImageTarget, p as ImageTargetAnchor, q as ImageTargetAnchorOptions, r as ImageTargetReference, s as InstanceSlotComponent, t as InstanceTransform, u as InstancedMeshComponent, v as InstancedMeshKind, L as LightComponent, w as LightValueState, M as MaterialComponent, x as MaterialTypeValue, y as MaterialValueState, z as MeshComponent, B as MeshGeometryComponent, F as MeshGeometryParameters, G as MeshGeometryParametersByKind, H as ModelComponent, N as Name, O as Object3DRef, P as PhysicsComponent, J as PhysicsState, K as PlaneMeshParameters, R as RadiusHeightMeshParameters, Q as RadiusMeshParameters, S as RigidbodyState, T as RigidbodyType, U as ScriptComponent, V as ScriptEntry, W as ScriptObjectComponent, X as ScriptObjectComponentInput, Y as ScriptObjectRuntimeState, Z as Selectable, _ as SelectionTransformState, $ as SpriteComponent, a0 as TextureFilteringValue, a1 as TransformModeValue, a2 as TransformSpaceValue, a3 as VRTeleportAreaComponent, a4 as VRTeleportAreaOptions, a5 as VideoComponent, a6 as VrTeleportShape, a7 as XRInteractableComponent, a8 as XRInteractableOptions, a9 as XRRigComponent, aa as XRRigOptions, ab as XrGrabMode, ac as XrLocomotionMode, ad as defaultMaterialValue, ae as normalizePhysicsState, af as setPhysicsLiveRef } from './XRRig-2686IqLQ.cjs';
2
2
  import { C as Component, D as DEFAULT_ENVIRONMENT_STATE, a as DEFAULT_POSTPROCESSING_STATE, E as Environment, b as EnvironmentFogState, c as EnvironmentFogType, d as EnvironmentGradientEffect, e as EnvironmentSkyboxState, f as EnvironmentSkyboxType, g as EnvironmentState, P as ParentId, h as Postprocessing, i as PostprocessingState, T as TransformComponent, j as TransformData, V as Vec3 } from './System-vrU46Vuw.cjs';
3
3
 
4
4
  /**
package/dist/index.cjs CHANGED
@@ -19,6 +19,8 @@ var OutputPass_js = require('three/examples/jsm/postprocessing/OutputPass.js');
19
19
  var HueSaturationShader_js = require('three/examples/jsm/shaders/HueSaturationShader.js');
20
20
  var SepiaShader_js = require('three/examples/jsm/shaders/SepiaShader.js');
21
21
  var VignetteShader_js = require('three/examples/jsm/shaders/VignetteShader.js');
22
+ var XRControllerModelFactory_js = require('three/examples/jsm/webxr/XRControllerModelFactory.js');
23
+ var XRHandModelFactory_js = require('three/examples/jsm/webxr/XRHandModelFactory.js');
22
24
 
23
25
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
24
26
  function _interopNamespace(e) {
@@ -2591,7 +2593,8 @@ var _VRTeleportAreaComponent = class _VRTeleportAreaComponent extends Component
2591
2593
  constructor(options) {
2592
2594
  super();
2593
2595
  this.enabled = options?.enabled ?? true;
2594
- this.shape = options?.shape ?? "plane";
2596
+ const shape = options?.shape;
2597
+ this.shape = shape === "cylinder" ? "circle" : options?.shape ?? "plane";
2595
2598
  this.width = options?.width ?? 10;
2596
2599
  this.depth = options?.depth ?? 10;
2597
2600
  }
@@ -3890,11 +3893,19 @@ function createTeleportArea({
3890
3893
  depthWrite: false
3891
3894
  });
3892
3895
  const object = new THREE38__namespace.Mesh(geometry, material);
3893
- object.rotation.x = -Math.PI / 2;
3894
3896
  const entityId = createBaseEntity(world, object, {
3895
3897
  label: payload.name ?? "Teleport Area",
3896
3898
  entityType: "teleportArea",
3897
- transformInput: payload.transform
3899
+ // The flat-on-the-ground rotation must live in the ECS TRANSFORM, not on
3900
+ // the Object3D: createBaseEntity applies the transform over the object, and
3901
+ // TransformSyncSystem re-applies it every frame — so a rotation set
3902
+ // directly on the mesh is overwritten immediately and the area stands up
3903
+ // like a wall. Same convention as the `plane` primitive.
3904
+ transformInput: {
3905
+ position: payload.transform?.position,
3906
+ rotation: payload.transform?.rotation ?? { x: -Math.PI / 2, y: 0, z: 0 },
3907
+ scale: payload.transform?.scale
3908
+ }
3898
3909
  });
3899
3910
  world.addComponent(
3900
3911
  entityId,
@@ -4330,6 +4341,15 @@ function buildComponentValueMaps(snapshot) {
4330
4341
  snapshot.components,
4331
4342
  "ScriptObjectComponent"
4332
4343
  ),
4344
+ xrRigValues: readByComponent(snapshot.components, "XRRigComponent"),
4345
+ vrTeleportAreaValues: readByComponent(
4346
+ snapshot.components,
4347
+ "VRTeleportAreaComponent"
4348
+ ),
4349
+ xrInteractableValues: readByComponent(
4350
+ snapshot.components,
4351
+ "XRInteractableComponent"
4352
+ ),
4333
4353
  instancedMeshValues: readByComponent(snapshot.components, "InstancedMeshComponent"),
4334
4354
  instanceSlotValues: readByComponent(snapshot.components, "InstanceSlotComponent"),
4335
4355
  prefabNodeValues: readByComponent(snapshot.components, "PrefabNode"),
@@ -4455,6 +4475,67 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
4455
4475
  soc.data = remapEntityRefsInScriptData(data, idMap);
4456
4476
  }
4457
4477
  }
4478
+ {
4479
+ const sourceXrRig = asRecord3(values.xrRigValues.get(sourceEntityId));
4480
+ const rig = world.getComponent(targetEntityId, XRRigComponent);
4481
+ if (sourceXrRig && rig) {
4482
+ if (typeof sourceXrRig.locomotion === "string") {
4483
+ rig.locomotion = sourceXrRig.locomotion;
4484
+ }
4485
+ if (typeof sourceXrRig.moveSpeed === "number") {
4486
+ rig.moveSpeed = sourceXrRig.moveSpeed;
4487
+ }
4488
+ if (typeof sourceXrRig.snapTurn === "boolean") {
4489
+ rig.snapTurn = sourceXrRig.snapTurn;
4490
+ }
4491
+ if (typeof sourceXrRig.snapTurnDegrees === "number") {
4492
+ rig.snapTurnDegrees = sourceXrRig.snapTurnDegrees;
4493
+ }
4494
+ if (typeof sourceXrRig.fallbackEyeHeight === "number") {
4495
+ rig.fallbackEyeHeight = sourceXrRig.fallbackEyeHeight;
4496
+ }
4497
+ }
4498
+ }
4499
+ {
4500
+ const sourceArea = asRecord3(values.vrTeleportAreaValues.get(sourceEntityId));
4501
+ const area = world.getComponent(targetEntityId, VRTeleportAreaComponent);
4502
+ if (sourceArea && area) {
4503
+ if (typeof sourceArea.enabled === "boolean") {
4504
+ area.enabled = sourceArea.enabled;
4505
+ }
4506
+ if (typeof sourceArea.shape === "string") {
4507
+ area.shape = sourceArea.shape === "cylinder" ? "circle" : sourceArea.shape;
4508
+ }
4509
+ if (typeof sourceArea.width === "number") area.width = sourceArea.width;
4510
+ if (typeof sourceArea.depth === "number") area.depth = sourceArea.depth;
4511
+ }
4512
+ }
4513
+ {
4514
+ const sourceInteractable = asRecord3(
4515
+ values.xrInteractableValues.get(sourceEntityId)
4516
+ );
4517
+ const interactable = world.getComponent(
4518
+ targetEntityId,
4519
+ XRInteractableComponent
4520
+ );
4521
+ if (sourceInteractable && interactable) {
4522
+ if (typeof sourceInteractable.enabled === "boolean") {
4523
+ interactable.enabled = sourceInteractable.enabled;
4524
+ }
4525
+ if (typeof sourceInteractable.grabbable === "boolean") {
4526
+ interactable.grabbable = sourceInteractable.grabbable;
4527
+ }
4528
+ if (typeof sourceInteractable.pointable === "boolean") {
4529
+ interactable.pointable = sourceInteractable.pointable;
4530
+ }
4531
+ if (typeof sourceInteractable.grabMode === "string") {
4532
+ interactable.grabMode = sourceInteractable.grabMode;
4533
+ }
4534
+ if (typeof sourceInteractable.highlightOnHover === "boolean") {
4535
+ interactable.highlightOnHover = sourceInteractable.highlightOnHover;
4536
+ }
4537
+ }
4538
+ }
4458
4539
  {
4459
4540
  const imComponent = world.getComponent(targetEntityId, InstancedMeshComponent);
4460
4541
  if (imComponent && imComponent.instanceEntityIds.length > 0) {
@@ -10647,6 +10728,128 @@ var _XRSessionSystem = class _XRSessionSystem {
10647
10728
  };
10648
10729
  __name(_XRSessionSystem, "XRSessionSystem");
10649
10730
  var XRSessionSystem = _XRSessionSystem;
10731
+ function buildGeometry2(area) {
10732
+ if (area.shape === "circle") {
10733
+ const radius = Math.max(5e-3, area.width / 2);
10734
+ return new THREE38__namespace.CircleGeometry(radius, 48);
10735
+ }
10736
+ return new THREE38__namespace.PlaneGeometry(
10737
+ Math.max(0.01, area.width),
10738
+ Math.max(0.01, area.depth)
10739
+ );
10740
+ }
10741
+ __name(buildGeometry2, "buildGeometry");
10742
+ function signatureOf(area) {
10743
+ return `${area.shape}:${area.width}:${area.depth}`;
10744
+ }
10745
+ __name(signatureOf, "signatureOf");
10746
+ var _VRTeleportAreaSystem = class _VRTeleportAreaSystem {
10747
+ constructor() {
10748
+ this.signatures = /* @__PURE__ */ new Map();
10749
+ }
10750
+ update(world) {
10751
+ const entityIds = world.query(VRTeleportAreaComponent, Object3DRef);
10752
+ const alive = new Set(entityIds);
10753
+ for (const tracked of this.signatures.keys()) {
10754
+ if (!alive.has(tracked)) this.signatures.delete(tracked);
10755
+ }
10756
+ for (const entityId of entityIds) {
10757
+ const area = world.getComponent(entityId, VRTeleportAreaComponent);
10758
+ const object = world.getComponent(entityId, Object3DRef)?.object;
10759
+ if (!area || !(object instanceof THREE38__namespace.Mesh)) continue;
10760
+ const signature = signatureOf(area);
10761
+ if (this.signatures.get(entityId) === signature) continue;
10762
+ this.signatures.set(entityId, signature);
10763
+ object.geometry?.dispose?.();
10764
+ object.geometry = buildGeometry2(area);
10765
+ }
10766
+ }
10767
+ };
10768
+ __name(_VRTeleportAreaSystem, "VRTeleportAreaSystem");
10769
+ var VRTeleportAreaSystem = _VRTeleportAreaSystem;
10770
+ var _XRControllerVisualSystem = class _XRControllerVisualSystem {
10771
+ constructor(slots = 2) {
10772
+ this.controllerModelFactory = new XRControllerModelFactory_js.XRControllerModelFactory();
10773
+ this.handModelFactory = new XRHandModelFactory_js.XRHandModelFactory();
10774
+ this.group = new THREE38__namespace.Group();
10775
+ this.built = false;
10776
+ this.attachedTo = null;
10777
+ /** Index → whether we've already attached visuals for that slot. */
10778
+ this.ready = /* @__PURE__ */ new Set();
10779
+ this.slots = slots;
10780
+ this.group.name = "XRControllerVisuals";
10781
+ this.group.userData.ecsPreviewHidden = true;
10782
+ }
10783
+ update(world) {
10784
+ const renderer = world.getRenderer();
10785
+ if (!renderer.xr?.enabled) return;
10786
+ this.ensureAttached(world);
10787
+ if (this.built) return;
10788
+ for (let index = 0; index < this.slots; index += 1) {
10789
+ if (this.ready.has(index)) continue;
10790
+ const controller = renderer.xr.getController(index);
10791
+ const grip = renderer.xr.getControllerGrip(index);
10792
+ const hand = renderer.xr.getHand(index);
10793
+ if (!controller || !grip || !hand) continue;
10794
+ controller.add(this.createRay());
10795
+ this.group.add(controller);
10796
+ grip.add(this.controllerModelFactory.createControllerModel(grip));
10797
+ this.group.add(grip);
10798
+ hand.add(this.handModelFactory.createHandModel(hand, "mesh"));
10799
+ this.group.add(hand);
10800
+ this.ready.add(index);
10801
+ }
10802
+ if (this.ready.size >= this.slots) {
10803
+ this.built = true;
10804
+ }
10805
+ }
10806
+ /**
10807
+ * Parent the visuals to the XR rig when there is one, so locomotion moves the
10808
+ * hands with the player. Falls back to the scene root.
10809
+ */
10810
+ ensureAttached(world) {
10811
+ const camera = world.getCamera();
10812
+ const target = camera.parent ?? world.getScene();
10813
+ if (this.attachedTo === target) return;
10814
+ target.add(this.group);
10815
+ this.attachedTo = target;
10816
+ }
10817
+ createRay() {
10818
+ const geometry = new THREE38__namespace.BufferGeometry().setFromPoints([
10819
+ new THREE38__namespace.Vector3(0, 0, 0),
10820
+ new THREE38__namespace.Vector3(0, 0, -5)
10821
+ ]);
10822
+ const material = new THREE38__namespace.LineBasicMaterial({
10823
+ color: "#4da3ff",
10824
+ transparent: true,
10825
+ opacity: 0.6,
10826
+ depthTest: false
10827
+ });
10828
+ const line = new THREE38__namespace.Line(geometry, material);
10829
+ line.name = "XRPointerRay";
10830
+ line.renderOrder = 999;
10831
+ return line;
10832
+ }
10833
+ dispose() {
10834
+ this.group.removeFromParent();
10835
+ this.group.traverse((child) => {
10836
+ const mesh = child;
10837
+ mesh.geometry?.dispose?.();
10838
+ const material = mesh.material;
10839
+ if (Array.isArray(material)) {
10840
+ for (const entry of material) entry.dispose?.();
10841
+ } else {
10842
+ material?.dispose?.();
10843
+ }
10844
+ });
10845
+ this.group.clear();
10846
+ this.ready.clear();
10847
+ this.built = false;
10848
+ this.attachedTo = null;
10849
+ }
10850
+ };
10851
+ __name(_XRControllerVisualSystem, "XRControllerVisualSystem");
10852
+ var XRControllerVisualSystem = _XRControllerVisualSystem;
10650
10853
 
10651
10854
  // core/World.ts
10652
10855
  var _World = class _World {
@@ -10992,6 +11195,7 @@ var _World = class _World {
10992
11195
  const postprocessingSyncSystem = this.featureFlags.supportPostprocessing ? new PostprocessingSyncSystem(this.renderer, this.scene, this.camera) : null;
10993
11196
  const lightSyncSystem = new LightSyncSystem();
10994
11197
  const materialSyncSystem = new MaterialSyncSystem();
11198
+ const vrTeleportAreaSystem = new VRTeleportAreaSystem();
10995
11199
  const physicsSyncSystem = new PhysicsSyncSystem({
10996
11200
  isEditor: isEditor ?? false
10997
11201
  });
@@ -11021,6 +11225,7 @@ var _World = class _World {
11021
11225
  }
11022
11226
  this.addSystems([
11023
11227
  ...coreSystems,
11228
+ vrTeleportAreaSystem,
11024
11229
  physicsSyncSystem,
11025
11230
  ...systems,
11026
11231
  objectVisibilitySystem,
@@ -12052,8 +12257,10 @@ exports.ScriptBehaviourSystem = ScriptBehaviourSystem;
12052
12257
  exports.ScriptObject = ScriptObject;
12053
12258
  exports.ScriptObjectSystem = ScriptObjectSystem;
12054
12259
  exports.TransformSyncSystem = TransformSyncSystem;
12260
+ exports.VRTeleportAreaSystem = VRTeleportAreaSystem;
12055
12261
  exports.VideoSystem = VideoSystem;
12056
12262
  exports.World = World;
12263
+ exports.XRControllerVisualSystem = XRControllerVisualSystem;
12057
12264
  exports.XRInputSystem = XRInputSystem;
12058
12265
  exports.XRInteractionSystem = XRInteractionSystem;
12059
12266
  exports.XRLocomotionSystem = XRLocomotionSystem;