@relu-interactives/spatial-ecs 0.3.17 → 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-CE2CPZSP.js → chunk-7SSOZWXM.js} +113 -35
  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-ekS4iypo.d.cts → index-7CFf45fo.d.cts} +22 -1
  23. package/dist/{index-BL5EWkwY.d.cts → index-CA9fqh4Z.d.cts} +1 -1
  24. package/dist/{index-uKFxVCmr.d.ts → index-D7aSZ-e9.d.ts} +22 -1
  25. package/dist/{index-ByiUoIoh.d.ts → index-DhWfxUgL.d.ts} +1 -1
  26. package/dist/index.cjs +112 -31
  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 +112 -31
  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-CE2CPZSP.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
@@ -751,15 +751,36 @@ declare class XRControllerVisualSystem implements EcsSystem {
751
751
  declare class XRTeleportVisualSystem implements EcsSystem {
752
752
  private readonly locomotionSystem;
753
753
  private readonly group;
754
+ /** Holds the segment chain that draws the arc. */
754
755
  private readonly arc;
755
- 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;
756
766
  private readonly marker;
757
767
  private attached;
768
+ private readonly scratchDirection;
769
+ private readonly scratchHead;
770
+ private readonly validColor;
771
+ private readonly invalidColor;
758
772
  constructor(locomotionSystem: XRLocomotionSystem);
759
773
  update(world: World): void;
760
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;
761
780
  private createRing;
762
781
  private createDot;
782
+ /** Recolour the landing marker to match the arc. */
783
+ private tintMarker;
763
784
  private setVisible;
764
785
  dispose(): void;
765
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
  /**
@@ -751,15 +751,36 @@ declare class XRControllerVisualSystem implements EcsSystem {
751
751
  declare class XRTeleportVisualSystem implements EcsSystem {
752
752
  private readonly locomotionSystem;
753
753
  private readonly group;
754
+ /** Holds the segment chain that draws the arc. */
754
755
  private readonly arc;
755
- 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;
756
766
  private readonly marker;
757
767
  private attached;
768
+ private readonly scratchDirection;
769
+ private readonly scratchHead;
770
+ private readonly validColor;
771
+ private readonly invalidColor;
758
772
  constructor(locomotionSystem: XRLocomotionSystem);
759
773
  update(world: World): void;
760
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;
761
780
  private createRing;
762
781
  private createDot;
782
+ /** Recolour the landing marker to match the arc. */
783
+ private tintMarker;
763
784
  private setVisible;
764
785
  dispose(): void;
765
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
  }
@@ -12625,24 +12637,33 @@ __name(_XRControllerVisualSystem, "XRControllerVisualSystem");
12625
12637
  var XRControllerVisualSystem = _XRControllerVisualSystem;
12626
12638
  var MARKER_RADIUS = 0.28;
12627
12639
  var ACCENT = new THREE51__namespace.Color("#4da3ff");
12628
- var BLOCKED = new THREE51__namespace.Color("#ff5a5a");
12640
+ var SEGMENT_AXIS = new THREE51__namespace.Vector3(0, 1, 0);
12641
+ var HEAD_CLEARANCE = 0.25;
12629
12642
  var _XRTeleportVisualSystem = class _XRTeleportVisualSystem {
12630
12643
  constructor(locomotionSystem) {
12631
12644
  this.group = new THREE51__namespace.Group();
12632
- 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 = [];
12633
12657
  this.marker = new THREE51__namespace.Group();
12634
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();
12635
12663
  this.locomotionSystem = locomotionSystem;
12636
12664
  this.group.name = "XRTeleportVisuals";
12637
12665
  this.group.userData.ecsPreviewHidden = true;
12638
- const arcMaterial = new THREE51__namespace.LineBasicMaterial({
12639
- vertexColors: true,
12640
- transparent: true,
12641
- depthTest: false
12642
- });
12643
- this.arc = new THREE51__namespace.Line(this.arcGeometry, arcMaterial);
12644
- this.arc.frustumCulled = false;
12645
- this.arc.renderOrder = 998;
12666
+ this.arc.name = "XRTeleportArc";
12646
12667
  this.group.add(this.arc);
12647
12668
  this.marker.add(this.createRing(), this.createDot());
12648
12669
  this.marker.renderOrder = 999;
@@ -12654,15 +12675,27 @@ var _XRTeleportVisualSystem = class _XRTeleportVisualSystem {
12654
12675
  world.getScene().add(this.group);
12655
12676
  this.attached = true;
12656
12677
  }
12657
- const curve = this.locomotionSystem.getAimCurve();
12678
+ const raw = this.locomotionSystem.getAimCurve();
12658
12679
  const landing = this.locomotionSystem.getLandingPoint();
12659
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);
12660
12686
  if (curve.length < 2) {
12661
12687
  this.setVisible(false);
12662
12688
  return;
12663
12689
  }
12664
- 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);
12665
12697
  if (valid && landing) {
12698
+ this.tintMarker(tint);
12666
12699
  this.marker.position.copy(landing);
12667
12700
  this.marker.position.y += 0.01;
12668
12701
  this.marker.visible = true;
@@ -12671,27 +12704,66 @@ var _XRTeleportVisualSystem = class _XRTeleportVisualSystem {
12671
12704
  }
12672
12705
  this.setVisible(true);
12673
12706
  }
12674
- updateArcGeometry(curve, tint) {
12675
- const count = curve.length;
12676
- const positions = new Float32Array(count * 3);
12677
- const colors = new Float32Array(count * 3);
12678
- for (let i = 0; i < count; i += 1) {
12679
- const point = curve[i];
12680
- positions[i * 3] = point.x;
12681
- positions[i * 3 + 1] = point.y;
12682
- positions[i * 3 + 2] = point.z;
12683
- 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;
12684
12733
  const fade = 1 - t * 0.75;
12685
- colors[i * 3] = tint.r * fade;
12686
- colors[i * 3 + 1] = tint.g * fade;
12687
- colors[i * 3 + 2] = tint.b * fade;
12734
+ segment.material.color.copy(tint).multiplyScalar(fade);
12688
12735
  }
12689
- this.arcGeometry.setAttribute(
12690
- "position",
12691
- new THREE51__namespace.BufferAttribute(positions, 3)
12692
- );
12693
- this.arcGeometry.setAttribute("color", new THREE51__namespace.BufferAttribute(colors, 3));
12694
- 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;
12695
12767
  }
12696
12768
  createRing() {
12697
12769
  const geometry = new THREE51__namespace.RingGeometry(
@@ -12725,6 +12797,15 @@ var _XRTeleportVisualSystem = class _XRTeleportVisualSystem {
12725
12797
  })
12726
12798
  );
12727
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
+ }
12728
12809
  setVisible(visible) {
12729
12810
  this.group.visible = visible;
12730
12811
  }