@relu-interactives/spatial-ecs 0.3.15 → 0.3.18

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 (38) hide show
  1. package/dist/{XRHandPose-LR4EhboN.d.cts → XRHandPose-B8xxFb9A.d.cts} +12 -0
  2. package/dist/{XRHandPose-SZ7ou63b.d.ts → XRHandPose-ubMe5Igc.d.ts} +12 -0
  3. package/dist/{chunk-GULLCPO6.js → chunk-7SSOZWXM.js} +123 -36
  4. package/dist/chunk-7SSOZWXM.js.map +1 -0
  5. package/dist/{chunk-3LDQ4GVZ.js → chunk-J3EUNW57.js} +5 -2
  6. package/dist/chunk-J3EUNW57.js.map +1 -0
  7. package/dist/{chunk-UHJ4MDIM.js → chunk-KRWBNC6Y.js} +4 -4
  8. package/dist/{chunk-UHJ4MDIM.js.map → chunk-KRWBNC6Y.js.map} +1 -1
  9. package/dist/{chunk-PNQ7HDQC.js → chunk-PFE2SDXR.js} +3 -3
  10. package/dist/{chunk-PNQ7HDQC.js.map → chunk-PFE2SDXR.js.map} +1 -1
  11. package/dist/components/index.cjs +3 -0
  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/docs/guide/vr-and-hand-poses.md +1 -1
  17. package/dist/factories/index.cjs +3 -0
  18. package/dist/factories/index.cjs.map +1 -1
  19. package/dist/factories/index.d.cts +1 -1
  20. package/dist/factories/index.d.ts +1 -1
  21. package/dist/factories/index.js +3 -3
  22. package/dist/{index-BKGV3VvQ.d.cts → index-7CFf45fo.d.cts} +24 -1
  23. package/dist/{index-BL5EWkwY.d.cts → index-CA9fqh4Z.d.cts} +1 -1
  24. package/dist/{index-Bi7L3QHF.d.ts → index-D7aSZ-e9.d.ts} +24 -1
  25. package/dist/{index-ByiUoIoh.d.ts → index-DhWfxUgL.d.ts} +1 -1
  26. package/dist/index.cjs +122 -32
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +5 -5
  29. package/dist/index.d.ts +5 -5
  30. package/dist/index.js +8 -8
  31. package/dist/systems/index.cjs +122 -32
  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-3LDQ4GVZ.js.map +0 -1
  38. package/dist/chunk-GULLCPO6.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { A as AnimationComponent, b as AudioComponent, c as CameraComponentOptions, C as CameraComponent, T as RigidbodyState, g as ColliderState, P as PhysicsComponent, o as EntityType, I as ImageComponent, q as ImageTargetAnchor, p as ImageTarget, L as LightComponent, M as MaterialComponent, B as MeshComponent, F as MeshGeometryComponent, J as ModelComponent, N as Name, O as Object3DRef, W as ScriptEntry, V as ScriptComponent, Y as ScriptObjectComponentInput, X as ScriptObjectComponent, _ as Selectable, $ as SelectionTransformState, a0 as SpriteComponent, w as InstancedMeshKind, G as MeshGeometryParameters, v as InstancedMeshComponent, t as InstanceSlotComponent, a6 as VideoComponent, af as XRRigComponent, a4 as VRTeleportAreaComponent, a8 as XRHandPoseComponent, aa as XRInteractableComponent, ac as XRInteractorComponent, ae as XRInteractorSideComponent } from '../XRHandPose-LR4EhboN.cjs';
1
+ import { A as AnimationComponent, b as AudioComponent, c as CameraComponentOptions, C as CameraComponent, T as RigidbodyState, g as ColliderState, P as PhysicsComponent, o as EntityType, I as ImageComponent, q as ImageTargetAnchor, p as ImageTarget, L as LightComponent, M as MaterialComponent, B as MeshComponent, F as MeshGeometryComponent, J as ModelComponent, N as Name, O as Object3DRef, W as ScriptEntry, V as ScriptComponent, Y as ScriptObjectComponentInput, X as ScriptObjectComponent, _ as Selectable, $ as SelectionTransformState, a0 as SpriteComponent, w as InstancedMeshKind, G as MeshGeometryParameters, v as InstancedMeshComponent, t as InstanceSlotComponent, a6 as VideoComponent, af as XRRigComponent, a4 as VRTeleportAreaComponent, a8 as XRHandPoseComponent, aa as XRInteractableComponent, ac as XRInteractorComponent, ae as XRInteractorSideComponent } from '../XRHandPose-B8xxFb9A.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-BhnLw0fZ.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, T as RigidbodyState, g as ColliderState, P as PhysicsComponent, o as EntityType, I as ImageComponent, q as ImageTargetAnchor, p as ImageTarget, L as LightComponent, M as MaterialComponent, B as MeshComponent, F as MeshGeometryComponent, J as ModelComponent, N as Name, O as Object3DRef, W as ScriptEntry, V as ScriptComponent, Y as ScriptObjectComponentInput, X as ScriptObjectComponent, _ as Selectable, $ as SelectionTransformState, a0 as SpriteComponent, w as InstancedMeshKind, G as MeshGeometryParameters, v as InstancedMeshComponent, t as InstanceSlotComponent, a6 as VideoComponent, af as XRRigComponent, a4 as VRTeleportAreaComponent, a8 as XRHandPoseComponent, aa as XRInteractableComponent, ac as XRInteractorComponent, ae as XRInteractorSideComponent } from '../XRHandPose-SZ7ou63b.js';
1
+ import { A as AnimationComponent, b as AudioComponent, c as CameraComponentOptions, C as CameraComponent, T as RigidbodyState, g as ColliderState, P as PhysicsComponent, o as EntityType, I as ImageComponent, q as ImageTargetAnchor, p as ImageTarget, L as LightComponent, M as MaterialComponent, B as MeshComponent, F as MeshGeometryComponent, J as ModelComponent, N as Name, O as Object3DRef, W as ScriptEntry, V as ScriptComponent, Y as ScriptObjectComponentInput, X as ScriptObjectComponent, _ as Selectable, $ as SelectionTransformState, a0 as SpriteComponent, w as InstancedMeshKind, G as MeshGeometryParameters, v as InstancedMeshComponent, t as InstanceSlotComponent, a6 as VideoComponent, af as XRRigComponent, a4 as VRTeleportAreaComponent, a8 as XRHandPoseComponent, aa as XRInteractableComponent, ac as XRInteractorComponent, ae as XRInteractorSideComponent } from '../XRHandPose-ubMe5Igc.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-BhnLw0fZ.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, createXRHandPoseComponent, createXRInteractableComponent, createXRInteractorComponent, createXRInteractorSideComponent, createXRRigComponent, registerDefaultComponentFactories, registerDefaultFactories } from '../chunk-UHJ4MDIM.js';
2
- import '../chunk-PNQ7HDQC.js';
3
- import '../chunk-3LDQ4GVZ.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, createXRHandPoseComponent, createXRInteractableComponent, createXRInteractorComponent, createXRInteractorSideComponent, createXRRigComponent, registerDefaultComponentFactories, registerDefaultFactories } from '../chunk-KRWBNC6Y.js';
2
+ import '../chunk-PFE2SDXR.js';
3
+ import '../chunk-J3EUNW57.js';
4
4
  import '../chunk-OY7ZODZP.js';
5
5
  //# sourceMappingURL=index.js.map
6
6
  //# sourceMappingURL=index.js.map
@@ -550,6 +550,8 @@ declare class XRLocomotionSystem implements EcsSystem {
550
550
  private aimValid;
551
551
  /** Sources currently aiming via thumbstick (hysteresis, so it doesn't chatter). */
552
552
  private readonly stickAiming;
553
+ /** One-time warning when a committed teleport found nowhere to land. */
554
+ private warnedNoLanding;
553
555
  /** Gates teleport commits on a prior aim. See {@link TeleportAimGate}. */
554
556
  private readonly teleportAim;
555
557
  /** True once we've tried to self-heal camera parenting for this session. */
@@ -749,15 +751,36 @@ declare class XRControllerVisualSystem implements EcsSystem {
749
751
  declare class XRTeleportVisualSystem implements EcsSystem {
750
752
  private readonly locomotionSystem;
751
753
  private readonly group;
754
+ /** Holds the segment chain that draws the arc. */
752
755
  private readonly arc;
753
- private readonly arcGeometry;
756
+ /**
757
+ * Unit cylinder along +Y, reused by every segment.
758
+ *
759
+ * The arc was a `THREE.Line`, which WebGL always renders one pixel wide —
760
+ * effectively invisible on a headset, and not thickenable at all. A chain of
761
+ * scaled cylinders gives real thickness while rebuilding no geometry: each
762
+ * frame only moves, rotates and scales meshes that already exist.
763
+ */
764
+ private readonly segmentGeometry;
765
+ private readonly segments;
754
766
  private readonly marker;
755
767
  private attached;
768
+ private readonly scratchDirection;
769
+ private readonly scratchHead;
770
+ private readonly validColor;
771
+ private readonly invalidColor;
756
772
  constructor(locomotionSystem: XRLocomotionSystem);
757
773
  update(world: World): void;
758
774
  private updateArcGeometry;
775
+ /** Grow the segment pool to cover the current arc. */
776
+ private ensureSegments;
777
+ /** Drop leading points that sit too close to the viewer's head. */
778
+ private trimNearHead;
779
+ private resolveRig;
759
780
  private createRing;
760
781
  private createDot;
782
+ /** Recolour the landing marker to match the arc. */
783
+ private tintMarker;
761
784
  private setVisible;
762
785
  dispose(): void;
763
786
  }
@@ -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_POSE_CURLS, n as DEFAULT_RIGIDBODY_STATE, E as EditableMeshObjectKind, o as EntityType, I as ImageComponent, p as ImageTarget, q as ImageTargetAnchor, r as ImageTargetAnchorOptions, s as ImageTargetReference, t as InstanceSlotComponent, u as InstanceTransform, v as InstancedMeshComponent, w as InstancedMeshKind, L as LightComponent, x as LightValueState, M as MaterialComponent, y as MaterialTypeValue, z as MaterialValueState, B as MeshComponent, F as MeshGeometryComponent, G as MeshGeometryParameters, H as MeshGeometryParametersByKind, J as ModelComponent, N as Name, O as Object3DRef, P as PhysicsComponent, K as PhysicsState, Q as PlaneMeshParameters, R as RadiusHeightMeshParameters, S as RadiusMeshParameters, T as RigidbodyState, U as RigidbodyType, V as ScriptComponent, W as ScriptEntry, X as ScriptObjectComponent, Y as ScriptObjectComponentInput, Z as ScriptObjectRuntimeState, _ as Selectable, $ as SelectionTransformState, a0 as SpriteComponent, a1 as TextureFilteringValue, a2 as TransformModeValue, a3 as TransformSpaceValue, a4 as VRTeleportAreaComponent, a5 as VRTeleportAreaOptions, a6 as VideoComponent, a7 as VrTeleportShape, a8 as XRHandPoseComponent, a9 as XRHandPoseOptions, aa as XRInteractableComponent, ab as XRInteractableOptions, ac as XRInteractorComponent, ad as XRInteractorOptions, ae as XRInteractorSideComponent, af as XRRigComponent, ag as XRRigOptions, ah as XrAttachPoint, ai as XrDistanceGrabBehavior, aj as XrGrabGesture, ak as XrGrabHands, al as XrGrabReach, am as XrHandPoseEntry, an as XrHandPreset, ao as XrInteractorSide, ap as XrInteractorType, aq as XrLocomotionMode, ar as XrTrackingOrigin, as as XrTwoHandRotation, at as createAttachPoint, au as createHandPoseEntry, av as defaultMaterialValue, aw as handPoseDefinitionFor, ax as normalizePhysicsState, ay as setPhysicsLiveRef } from './XRHandPose-LR4EhboN.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_POSE_CURLS, n as DEFAULT_RIGIDBODY_STATE, E as EditableMeshObjectKind, o as EntityType, I as ImageComponent, p as ImageTarget, q as ImageTargetAnchor, r as ImageTargetAnchorOptions, s as ImageTargetReference, t as InstanceSlotComponent, u as InstanceTransform, v as InstancedMeshComponent, w as InstancedMeshKind, L as LightComponent, x as LightValueState, M as MaterialComponent, y as MaterialTypeValue, z as MaterialValueState, B as MeshComponent, F as MeshGeometryComponent, G as MeshGeometryParameters, H as MeshGeometryParametersByKind, J as ModelComponent, N as Name, O as Object3DRef, P as PhysicsComponent, K as PhysicsState, Q as PlaneMeshParameters, R as RadiusHeightMeshParameters, S as RadiusMeshParameters, T as RigidbodyState, U as RigidbodyType, V as ScriptComponent, W as ScriptEntry, X as ScriptObjectComponent, Y as ScriptObjectComponentInput, Z as ScriptObjectRuntimeState, _ as Selectable, $ as SelectionTransformState, a0 as SpriteComponent, a1 as TextureFilteringValue, a2 as TransformModeValue, a3 as TransformSpaceValue, a4 as VRTeleportAreaComponent, a5 as VRTeleportAreaOptions, a6 as VideoComponent, a7 as VrTeleportShape, a8 as XRHandPoseComponent, a9 as XRHandPoseOptions, aa as XRInteractableComponent, ab as XRInteractableOptions, ac as XRInteractorComponent, ad as XRInteractorOptions, ae as XRInteractorSideComponent, af as XRRigComponent, ag as XRRigOptions, ah as XrAttachPoint, ai as XrDistanceGrabBehavior, aj as XrGrabGesture, ak as XrGrabHands, al as XrGrabReach, am as XrHandPoseEntry, an as XrHandPreset, ao as XrInteractorSide, ap as XrInteractorType, aq as XrLocomotionMode, ar as XrTrackingOrigin, as as XrTwoHandRotation, at as createAttachPoint, au as createHandPoseEntry, av as defaultMaterialValue, aw as handPoseDefinitionFor, ax as normalizePhysicsState, ay as setPhysicsLiveRef } from './XRHandPose-B8xxFb9A.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-BhnLw0fZ.cjs';
3
3
 
4
4
  /**
@@ -550,6 +550,8 @@ declare class XRLocomotionSystem implements EcsSystem {
550
550
  private aimValid;
551
551
  /** Sources currently aiming via thumbstick (hysteresis, so it doesn't chatter). */
552
552
  private readonly stickAiming;
553
+ /** One-time warning when a committed teleport found nowhere to land. */
554
+ private warnedNoLanding;
553
555
  /** Gates teleport commits on a prior aim. See {@link TeleportAimGate}. */
554
556
  private readonly teleportAim;
555
557
  /** True once we've tried to self-heal camera parenting for this session. */
@@ -749,15 +751,36 @@ declare class XRControllerVisualSystem implements EcsSystem {
749
751
  declare class XRTeleportVisualSystem implements EcsSystem {
750
752
  private readonly locomotionSystem;
751
753
  private readonly group;
754
+ /** Holds the segment chain that draws the arc. */
752
755
  private readonly arc;
753
- private readonly arcGeometry;
756
+ /**
757
+ * Unit cylinder along +Y, reused by every segment.
758
+ *
759
+ * The arc was a `THREE.Line`, which WebGL always renders one pixel wide —
760
+ * effectively invisible on a headset, and not thickenable at all. A chain of
761
+ * scaled cylinders gives real thickness while rebuilding no geometry: each
762
+ * frame only moves, rotates and scales meshes that already exist.
763
+ */
764
+ private readonly segmentGeometry;
765
+ private readonly segments;
754
766
  private readonly marker;
755
767
  private attached;
768
+ private readonly scratchDirection;
769
+ private readonly scratchHead;
770
+ private readonly validColor;
771
+ private readonly invalidColor;
756
772
  constructor(locomotionSystem: XRLocomotionSystem);
757
773
  update(world: World): void;
758
774
  private updateArcGeometry;
775
+ /** Grow the segment pool to cover the current arc. */
776
+ private ensureSegments;
777
+ /** Drop leading points that sit too close to the viewer's head. */
778
+ private trimNearHead;
779
+ private resolveRig;
759
780
  private createRing;
760
781
  private createDot;
782
+ /** Recolour the landing marker to match the arc. */
783
+ private tintMarker;
761
784
  private setVisible;
762
785
  dispose(): void;
763
786
  }
@@ -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_POSE_CURLS, n as DEFAULT_RIGIDBODY_STATE, E as EditableMeshObjectKind, o as EntityType, I as ImageComponent, p as ImageTarget, q as ImageTargetAnchor, r as ImageTargetAnchorOptions, s as ImageTargetReference, t as InstanceSlotComponent, u as InstanceTransform, v as InstancedMeshComponent, w as InstancedMeshKind, L as LightComponent, x as LightValueState, M as MaterialComponent, y as MaterialTypeValue, z as MaterialValueState, B as MeshComponent, F as MeshGeometryComponent, G as MeshGeometryParameters, H as MeshGeometryParametersByKind, J as ModelComponent, N as Name, O as Object3DRef, P as PhysicsComponent, K as PhysicsState, Q as PlaneMeshParameters, R as RadiusHeightMeshParameters, S as RadiusMeshParameters, T as RigidbodyState, U as RigidbodyType, V as ScriptComponent, W as ScriptEntry, X as ScriptObjectComponent, Y as ScriptObjectComponentInput, Z as ScriptObjectRuntimeState, _ as Selectable, $ as SelectionTransformState, a0 as SpriteComponent, a1 as TextureFilteringValue, a2 as TransformModeValue, a3 as TransformSpaceValue, a4 as VRTeleportAreaComponent, a5 as VRTeleportAreaOptions, a6 as VideoComponent, a7 as VrTeleportShape, a8 as XRHandPoseComponent, a9 as XRHandPoseOptions, aa as XRInteractableComponent, ab as XRInteractableOptions, ac as XRInteractorComponent, ad as XRInteractorOptions, ae as XRInteractorSideComponent, af as XRRigComponent, ag as XRRigOptions, ah as XrAttachPoint, ai as XrDistanceGrabBehavior, aj as XrGrabGesture, ak as XrGrabHands, al as XrGrabReach, am as XrHandPoseEntry, an as XrHandPreset, ao as XrInteractorSide, ap as XrInteractorType, aq as XrLocomotionMode, ar as XrTrackingOrigin, as as XrTwoHandRotation, at as createAttachPoint, au as createHandPoseEntry, av as defaultMaterialValue, aw as handPoseDefinitionFor, ax as normalizePhysicsState, ay as setPhysicsLiveRef } from './XRHandPose-SZ7ou63b.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_POSE_CURLS, n as DEFAULT_RIGIDBODY_STATE, E as EditableMeshObjectKind, o as EntityType, I as ImageComponent, p as ImageTarget, q as ImageTargetAnchor, r as ImageTargetAnchorOptions, s as ImageTargetReference, t as InstanceSlotComponent, u as InstanceTransform, v as InstancedMeshComponent, w as InstancedMeshKind, L as LightComponent, x as LightValueState, M as MaterialComponent, y as MaterialTypeValue, z as MaterialValueState, B as MeshComponent, F as MeshGeometryComponent, G as MeshGeometryParameters, H as MeshGeometryParametersByKind, J as ModelComponent, N as Name, O as Object3DRef, P as PhysicsComponent, K as PhysicsState, Q as PlaneMeshParameters, R as RadiusHeightMeshParameters, S as RadiusMeshParameters, T as RigidbodyState, U as RigidbodyType, V as ScriptComponent, W as ScriptEntry, X as ScriptObjectComponent, Y as ScriptObjectComponentInput, Z as ScriptObjectRuntimeState, _ as Selectable, $ as SelectionTransformState, a0 as SpriteComponent, a1 as TextureFilteringValue, a2 as TransformModeValue, a3 as TransformSpaceValue, a4 as VRTeleportAreaComponent, a5 as VRTeleportAreaOptions, a6 as VideoComponent, a7 as VrTeleportShape, a8 as XRHandPoseComponent, a9 as XRHandPoseOptions, aa as XRInteractableComponent, ab as XRInteractableOptions, ac as XRInteractorComponent, ad as XRInteractorOptions, ae as XRInteractorSideComponent, af as XRRigComponent, ag as XRRigOptions, ah as XrAttachPoint, ai as XrDistanceGrabBehavior, aj as XrGrabGesture, ak as XrGrabHands, al as XrGrabReach, am as XrHandPoseEntry, an as XrHandPreset, ao as XrInteractorSide, ap as XrInteractorType, aq as XrLocomotionMode, ar as XrTrackingOrigin, as as XrTwoHandRotation, at as createAttachPoint, au as createHandPoseEntry, av as defaultMaterialValue, aw as handPoseDefinitionFor, ax as normalizePhysicsState, ay as setPhysicsLiveRef } from './XRHandPose-ubMe5Igc.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-BhnLw0fZ.js';
3
3
 
4
4
  /**
package/dist/index.cjs CHANGED
@@ -2576,6 +2576,9 @@ var _XRRigComponent = class _XRRigComponent extends Component {
2576
2576
  this.snapTurn = options?.snapTurn ?? true;
2577
2577
  this.snapTurnDegrees = options?.snapTurnDegrees ?? 30;
2578
2578
  this.fallbackEyeHeight = options?.fallbackEyeHeight ?? 1.6;
2579
+ this.teleportArcColor = options?.teleportArcColor ?? "#4da3ff";
2580
+ this.teleportArcInvalidColor = options?.teleportArcInvalidColor ?? "#ff5a5a";
2581
+ this.teleportArcThickness = options?.teleportArcThickness ?? 0.012;
2579
2582
  }
2580
2583
  };
2581
2584
  __name(_XRRigComponent, "XRRigComponent");
@@ -4831,6 +4834,15 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
4831
4834
  if (typeof sourceXrRig.snapTurnDegrees === "number") {
4832
4835
  rig.snapTurnDegrees = sourceXrRig.snapTurnDegrees;
4833
4836
  }
4837
+ if (typeof sourceXrRig.teleportArcColor === "string") {
4838
+ rig.teleportArcColor = sourceXrRig.teleportArcColor;
4839
+ }
4840
+ if (typeof sourceXrRig.teleportArcInvalidColor === "string") {
4841
+ rig.teleportArcInvalidColor = sourceXrRig.teleportArcInvalidColor;
4842
+ }
4843
+ if (typeof sourceXrRig.teleportArcThickness === "number") {
4844
+ rig.teleportArcThickness = sourceXrRig.teleportArcThickness;
4845
+ }
4834
4846
  if (typeof sourceXrRig.fallbackEyeHeight === "number") {
4835
4847
  rig.fallbackEyeHeight = sourceXrRig.fallbackEyeHeight;
4836
4848
  }
@@ -11875,6 +11887,8 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
11875
11887
  this.aimValid = false;
11876
11888
  /** Sources currently aiming via thumbstick (hysteresis, so it doesn't chatter). */
11877
11889
  this.stickAiming = /* @__PURE__ */ new WeakSet();
11890
+ /** One-time warning when a committed teleport found nowhere to land. */
11891
+ this.warnedNoLanding = false;
11878
11892
  /** Gates teleport commits on a prior aim. See {@link TeleportAimGate}. */
11879
11893
  this.teleportAim = new TeleportAimGate();
11880
11894
  /** True once we've tried to self-heal camera parenting for this session. */
@@ -12021,7 +12035,8 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
12021
12035
  }
12022
12036
  const stick = this.readStickAim(input, source);
12023
12037
  const aiming = input.select || input.selectStart || stick.aiming;
12024
- const releasing = input.selectEnd || stick.released;
12038
+ const vanished = !input.connected && this.teleportAim.isAiming(source);
12039
+ const releasing = input.selectEnd || stick.released || vanished;
12025
12040
  const commit = this.teleportAim.update(source, aiming, releasing);
12026
12041
  if (!aiming && !commit) continue;
12027
12042
  const points = sampleTeleportArc(
@@ -12041,6 +12056,12 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
12041
12056
  this.landingPoint = null;
12042
12057
  this.aimValid = false;
12043
12058
  } else if (commit) {
12059
+ if (!this.warnedNoLanding) {
12060
+ this.warnedNoLanding = true;
12061
+ console.warn(
12062
+ "[XRLocomotionSystem] Teleport released but the arc did not land on a Teleport Area. Add a teleportArea entity where the player should be able to go."
12063
+ );
12064
+ }
12044
12065
  this.aimCurve = [];
12045
12066
  this.aimValid = false;
12046
12067
  }
@@ -12616,24 +12637,33 @@ __name(_XRControllerVisualSystem, "XRControllerVisualSystem");
12616
12637
  var XRControllerVisualSystem = _XRControllerVisualSystem;
12617
12638
  var MARKER_RADIUS = 0.28;
12618
12639
  var ACCENT = new THREE51__namespace.Color("#4da3ff");
12619
- var BLOCKED = new THREE51__namespace.Color("#ff5a5a");
12640
+ var SEGMENT_AXIS = new THREE51__namespace.Vector3(0, 1, 0);
12641
+ var HEAD_CLEARANCE = 0.25;
12620
12642
  var _XRTeleportVisualSystem = class _XRTeleportVisualSystem {
12621
12643
  constructor(locomotionSystem) {
12622
12644
  this.group = new THREE51__namespace.Group();
12623
- this.arcGeometry = new THREE51__namespace.BufferGeometry();
12645
+ /** Holds the segment chain that draws the arc. */
12646
+ this.arc = new THREE51__namespace.Group();
12647
+ /**
12648
+ * Unit cylinder along +Y, reused by every segment.
12649
+ *
12650
+ * The arc was a `THREE.Line`, which WebGL always renders one pixel wide —
12651
+ * effectively invisible on a headset, and not thickenable at all. A chain of
12652
+ * scaled cylinders gives real thickness while rebuilding no geometry: each
12653
+ * frame only moves, rotates and scales meshes that already exist.
12654
+ */
12655
+ this.segmentGeometry = new THREE51__namespace.CylinderGeometry(1, 1, 1, 6, 1);
12656
+ this.segments = [];
12624
12657
  this.marker = new THREE51__namespace.Group();
12625
12658
  this.attached = false;
12659
+ this.scratchDirection = new THREE51__namespace.Vector3();
12660
+ this.scratchHead = new THREE51__namespace.Vector3();
12661
+ this.validColor = new THREE51__namespace.Color();
12662
+ this.invalidColor = new THREE51__namespace.Color();
12626
12663
  this.locomotionSystem = locomotionSystem;
12627
12664
  this.group.name = "XRTeleportVisuals";
12628
12665
  this.group.userData.ecsPreviewHidden = true;
12629
- const arcMaterial = new THREE51__namespace.LineBasicMaterial({
12630
- vertexColors: true,
12631
- transparent: true,
12632
- depthTest: false
12633
- });
12634
- this.arc = new THREE51__namespace.Line(this.arcGeometry, arcMaterial);
12635
- this.arc.frustumCulled = false;
12636
- this.arc.renderOrder = 998;
12666
+ this.arc.name = "XRTeleportArc";
12637
12667
  this.group.add(this.arc);
12638
12668
  this.marker.add(this.createRing(), this.createDot());
12639
12669
  this.marker.renderOrder = 999;
@@ -12645,15 +12675,27 @@ var _XRTeleportVisualSystem = class _XRTeleportVisualSystem {
12645
12675
  world.getScene().add(this.group);
12646
12676
  this.attached = true;
12647
12677
  }
12648
- const curve = this.locomotionSystem.getAimCurve();
12678
+ const raw = this.locomotionSystem.getAimCurve();
12649
12679
  const landing = this.locomotionSystem.getLandingPoint();
12650
12680
  const valid = this.locomotionSystem.isAimValid();
12681
+ if (raw.length < 2) {
12682
+ this.setVisible(false);
12683
+ return;
12684
+ }
12685
+ const curve = this.trimNearHead(world, raw);
12651
12686
  if (curve.length < 2) {
12652
12687
  this.setVisible(false);
12653
12688
  return;
12654
12689
  }
12655
- this.updateArcGeometry(curve, valid ? ACCENT : BLOCKED);
12690
+ const rig = this.resolveRig(world);
12691
+ const thickness = Math.min(
12692
+ 0.1,
12693
+ Math.max(1e-3, rig?.teleportArcThickness ?? 0.012)
12694
+ );
12695
+ const tint = valid ? this.validColor.set(rig?.teleportArcColor ?? "#4da3ff") : this.invalidColor.set(rig?.teleportArcInvalidColor ?? "#ff5a5a");
12696
+ this.updateArcGeometry(curve, tint, thickness);
12656
12697
  if (valid && landing) {
12698
+ this.tintMarker(tint);
12657
12699
  this.marker.position.copy(landing);
12658
12700
  this.marker.position.y += 0.01;
12659
12701
  this.marker.visible = true;
@@ -12662,27 +12704,66 @@ var _XRTeleportVisualSystem = class _XRTeleportVisualSystem {
12662
12704
  }
12663
12705
  this.setVisible(true);
12664
12706
  }
12665
- updateArcGeometry(curve, tint) {
12666
- const count = curve.length;
12667
- const positions = new Float32Array(count * 3);
12668
- const colors = new Float32Array(count * 3);
12669
- for (let i = 0; i < count; i += 1) {
12670
- const point = curve[i];
12671
- positions[i * 3] = point.x;
12672
- positions[i * 3 + 1] = point.y;
12673
- positions[i * 3 + 2] = point.z;
12674
- const t = count > 1 ? i / (count - 1) : 0;
12707
+ updateArcGeometry(curve, tint, thickness) {
12708
+ const needed = curve.length - 1;
12709
+ this.ensureSegments(needed);
12710
+ const radius = thickness / 2;
12711
+ for (let i = 0; i < this.segments.length; i += 1) {
12712
+ const segment = this.segments[i];
12713
+ if (i >= needed) {
12714
+ segment.visible = false;
12715
+ continue;
12716
+ }
12717
+ const from = curve[i];
12718
+ const to = curve[i + 1];
12719
+ this.scratchDirection.subVectors(to, from);
12720
+ const length = this.scratchDirection.length();
12721
+ if (length < 1e-6) {
12722
+ segment.visible = false;
12723
+ continue;
12724
+ }
12725
+ segment.visible = true;
12726
+ segment.position.copy(from).addScaledVector(this.scratchDirection, 0.5);
12727
+ segment.quaternion.setFromUnitVectors(
12728
+ SEGMENT_AXIS,
12729
+ this.scratchDirection.divideScalar(length)
12730
+ );
12731
+ segment.scale.set(radius, length, radius);
12732
+ const t = needed > 1 ? i / (needed - 1) : 0;
12675
12733
  const fade = 1 - t * 0.75;
12676
- colors[i * 3] = tint.r * fade;
12677
- colors[i * 3 + 1] = tint.g * fade;
12678
- colors[i * 3 + 2] = tint.b * fade;
12734
+ segment.material.color.copy(tint).multiplyScalar(fade);
12679
12735
  }
12680
- this.arcGeometry.setAttribute(
12681
- "position",
12682
- new THREE51__namespace.BufferAttribute(positions, 3)
12683
- );
12684
- this.arcGeometry.setAttribute("color", new THREE51__namespace.BufferAttribute(colors, 3));
12685
- this.arcGeometry.computeBoundingSphere();
12736
+ }
12737
+ /** Grow the segment pool to cover the current arc. */
12738
+ ensureSegments(count) {
12739
+ while (this.segments.length < count) {
12740
+ const material = new THREE51__namespace.MeshBasicMaterial({
12741
+ transparent: true,
12742
+ depthTest: false,
12743
+ depthWrite: false
12744
+ });
12745
+ const mesh = new THREE51__namespace.Mesh(this.segmentGeometry, material);
12746
+ mesh.frustumCulled = false;
12747
+ mesh.renderOrder = 998;
12748
+ mesh.raycast = () => {
12749
+ };
12750
+ this.segments.push(mesh);
12751
+ this.arc.add(mesh);
12752
+ }
12753
+ }
12754
+ /** Drop leading points that sit too close to the viewer's head. */
12755
+ trimNearHead(world, curve) {
12756
+ world.getCamera().getWorldPosition(this.scratchHead);
12757
+ let start = 0;
12758
+ while (start < curve.length - 2 && curve[start].distanceTo(this.scratchHead) < HEAD_CLEARANCE) {
12759
+ start += 1;
12760
+ }
12761
+ return start === 0 ? curve : curve.slice(start);
12762
+ }
12763
+ resolveRig(world) {
12764
+ const entityId = world.query(XRRigComponent)[0];
12765
+ if (typeof entityId !== "number") return null;
12766
+ return world.getComponent(entityId, XRRigComponent) ?? null;
12686
12767
  }
12687
12768
  createRing() {
12688
12769
  const geometry = new THREE51__namespace.RingGeometry(
@@ -12716,6 +12797,15 @@ var _XRTeleportVisualSystem = class _XRTeleportVisualSystem {
12716
12797
  })
12717
12798
  );
12718
12799
  }
12800
+ /** Recolour the landing marker to match the arc. */
12801
+ tintMarker(color) {
12802
+ this.marker.traverse((child) => {
12803
+ const material = child.material;
12804
+ if (material && !Array.isArray(material)) {
12805
+ material.color?.copy(color);
12806
+ }
12807
+ });
12808
+ }
12719
12809
  setVisible(visible) {
12720
12810
  this.group.visible = visible;
12721
12811
  }