@relu-interactives/spatial-ecs 0.3.11 → 0.3.12
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.
- package/dist/{XRHandPose-C-KJeYcJ.d.cts → XRHandPose-DawOR0uR.d.cts} +8 -0
- package/dist/{XRHandPose-B6I4y1lj.d.ts → XRHandPose-DhAd9Qi6.d.ts} +8 -0
- package/dist/{chunk-Y3AC3VZ2.js → chunk-7ZIN6TGT.js} +3 -3
- package/dist/{chunk-Y3AC3VZ2.js.map → chunk-7ZIN6TGT.js.map} +1 -1
- package/dist/{chunk-FSHRPY65.js → chunk-ID7U4FER.js} +4 -4
- package/dist/{chunk-FSHRPY65.js.map → chunk-ID7U4FER.js.map} +1 -1
- package/dist/{chunk-KLU2M43M.js → chunk-LCJ6IH2O.js} +60 -20
- package/dist/chunk-LCJ6IH2O.js.map +1 -0
- package/dist/{chunk-TXEGYR76.js → chunk-OMDYLFTN.js} +4 -2
- package/dist/chunk-OMDYLFTN.js.map +1 -0
- package/dist/components/index.cjs +2 -0
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +1 -1
- package/dist/docs/guide/vr-and-hand-poses.md +1 -1
- package/dist/factories/index.cjs +2 -0
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +1 -1
- package/dist/factories/index.d.ts +1 -1
- package/dist/factories/index.js +3 -3
- package/dist/{index-CEZp7qLL.d.ts → index-B49322Q3.d.ts} +1 -1
- package/dist/{index-jlgDou9W.d.cts → index-DJ9bn9SF.d.cts} +14 -0
- package/dist/{index-Bi_wIo1o.d.ts → index-M0I5B3JA.d.ts} +14 -0
- package/dist/{index-DPRnnSI-.d.cts → index-Xm3im4Pt.d.cts} +1 -1
- package/dist/index.cjs +58 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +8 -8
- package/dist/systems/index.cjs +58 -16
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +1 -1
- package/dist/systems/index.d.ts +1 -1
- package/dist/systems/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-KLU2M43M.js.map +0 -1
- package/dist/chunk-TXEGYR76.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-
|
|
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-DawOR0uR.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-31wk-A0g.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-
|
|
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-DhAd9Qi6.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-31wk-A0g.js';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
import '@dimforge/rapier3d-compat';
|
package/dist/factories/index.js
CHANGED
|
@@ -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-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
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-ID7U4FER.js';
|
|
2
|
+
import '../chunk-7ZIN6TGT.js';
|
|
3
|
+
import '../chunk-OMDYLFTN.js';
|
|
4
4
|
import '../chunk-OY7ZODZP.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -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-
|
|
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-DhAd9Qi6.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-31wk-A0g.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -500,6 +500,8 @@ declare class XRInteractionSystem implements EcsSystem {
|
|
|
500
500
|
getHeldEntityIds(): Set<number>;
|
|
501
501
|
/** True when any source is holding something. */
|
|
502
502
|
isGrabbing(): boolean;
|
|
503
|
+
/** True when THIS hand is holding something. */
|
|
504
|
+
isGrabbingWith(handedness: XrInputState["handedness"]): boolean;
|
|
503
505
|
/**
|
|
504
506
|
* How an entity is currently held.
|
|
505
507
|
*
|
|
@@ -648,6 +650,8 @@ declare class XRControllerVisualSystem implements EcsSystem {
|
|
|
648
650
|
private readonly controllerModelFactory;
|
|
649
651
|
private readonly handModelFactory;
|
|
650
652
|
private readonly group;
|
|
653
|
+
/** Reused so a per-frame colour compare allocates nothing. */
|
|
654
|
+
private readonly rayColorScratch;
|
|
651
655
|
private readonly slots;
|
|
652
656
|
private readonly interactionSystem;
|
|
653
657
|
/** Optional — lets each visual follow the source that is ACTUALLY live. */
|
|
@@ -686,6 +690,8 @@ declare class XRControllerVisualSystem implements EcsSystem {
|
|
|
686
690
|
* clutter implying the whole scene is clickable.
|
|
687
691
|
*/
|
|
688
692
|
private shouldShowRay;
|
|
693
|
+
/** Push the author's ray colour and thickness onto the mesh. */
|
|
694
|
+
private applyRayStyle;
|
|
689
695
|
/**
|
|
690
696
|
* Stop the ray at whatever it is pointing at.
|
|
691
697
|
*
|
|
@@ -701,6 +707,14 @@ declare class XRControllerVisualSystem implements EcsSystem {
|
|
|
701
707
|
* hands with the player. Falls back to the scene root.
|
|
702
708
|
*/
|
|
703
709
|
private ensureAttached;
|
|
710
|
+
/**
|
|
711
|
+
* The pointer ray.
|
|
712
|
+
*
|
|
713
|
+
* A cylinder rather than a `THREE.Line`, because WebGL ignores `linewidth` —
|
|
714
|
+
* every line renders one pixel wide regardless, which is nearly invisible on a
|
|
715
|
+
* headset. A thin mesh is the only way to get a ray with real thickness
|
|
716
|
+
* without pulling in a line-rendering extension.
|
|
717
|
+
*/
|
|
704
718
|
private createRay;
|
|
705
719
|
dispose(): void;
|
|
706
720
|
}
|
|
@@ -500,6 +500,8 @@ declare class XRInteractionSystem implements EcsSystem {
|
|
|
500
500
|
getHeldEntityIds(): Set<number>;
|
|
501
501
|
/** True when any source is holding something. */
|
|
502
502
|
isGrabbing(): boolean;
|
|
503
|
+
/** True when THIS hand is holding something. */
|
|
504
|
+
isGrabbingWith(handedness: XrInputState["handedness"]): boolean;
|
|
503
505
|
/**
|
|
504
506
|
* How an entity is currently held.
|
|
505
507
|
*
|
|
@@ -648,6 +650,8 @@ declare class XRControllerVisualSystem implements EcsSystem {
|
|
|
648
650
|
private readonly controllerModelFactory;
|
|
649
651
|
private readonly handModelFactory;
|
|
650
652
|
private readonly group;
|
|
653
|
+
/** Reused so a per-frame colour compare allocates nothing. */
|
|
654
|
+
private readonly rayColorScratch;
|
|
651
655
|
private readonly slots;
|
|
652
656
|
private readonly interactionSystem;
|
|
653
657
|
/** Optional — lets each visual follow the source that is ACTUALLY live. */
|
|
@@ -686,6 +690,8 @@ declare class XRControllerVisualSystem implements EcsSystem {
|
|
|
686
690
|
* clutter implying the whole scene is clickable.
|
|
687
691
|
*/
|
|
688
692
|
private shouldShowRay;
|
|
693
|
+
/** Push the author's ray colour and thickness onto the mesh. */
|
|
694
|
+
private applyRayStyle;
|
|
689
695
|
/**
|
|
690
696
|
* Stop the ray at whatever it is pointing at.
|
|
691
697
|
*
|
|
@@ -701,6 +707,14 @@ declare class XRControllerVisualSystem implements EcsSystem {
|
|
|
701
707
|
* hands with the player. Falls back to the scene root.
|
|
702
708
|
*/
|
|
703
709
|
private ensureAttached;
|
|
710
|
+
/**
|
|
711
|
+
* The pointer ray.
|
|
712
|
+
*
|
|
713
|
+
* A cylinder rather than a `THREE.Line`, because WebGL ignores `linewidth` —
|
|
714
|
+
* every line renders one pixel wide regardless, which is nearly invisible on a
|
|
715
|
+
* headset. A thin mesh is the only way to get a ray with real thickness
|
|
716
|
+
* without pulling in a line-rendering extension.
|
|
717
|
+
*/
|
|
704
718
|
private createRay;
|
|
705
719
|
dispose(): void;
|
|
706
720
|
}
|
|
@@ -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-
|
|
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-DawOR0uR.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-31wk-A0g.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -2891,6 +2891,8 @@ var _XRInteractorComponent = class _XRInteractorComponent extends Component {
|
|
|
2891
2891
|
this.handOpacity = options?.handOpacity ?? 1;
|
|
2892
2892
|
this.handEmissiveIntensity = options?.handEmissiveIntensity ?? 0;
|
|
2893
2893
|
this.showRay = options?.showRay ?? true;
|
|
2894
|
+
this.rayColor = options?.rayColor ?? "#4da3ff";
|
|
2895
|
+
this.rayThickness = options?.rayThickness ?? 6e-3;
|
|
2894
2896
|
}
|
|
2895
2897
|
};
|
|
2896
2898
|
__name(_XRInteractorComponent, "XRInteractorComponent");
|
|
@@ -4986,6 +4988,12 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
|
|
|
4986
4988
|
if (typeof sourceInteractor.showRay === "boolean") {
|
|
4987
4989
|
interactor.showRay = sourceInteractor.showRay;
|
|
4988
4990
|
}
|
|
4991
|
+
if (typeof sourceInteractor.rayColor === "string") {
|
|
4992
|
+
interactor.rayColor = sourceInteractor.rayColor;
|
|
4993
|
+
}
|
|
4994
|
+
if (typeof sourceInteractor.rayThickness === "number") {
|
|
4995
|
+
interactor.rayThickness = sourceInteractor.rayThickness;
|
|
4996
|
+
}
|
|
4989
4997
|
}
|
|
4990
4998
|
}
|
|
4991
4999
|
{
|
|
@@ -11709,6 +11717,13 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
11709
11717
|
isGrabbing() {
|
|
11710
11718
|
return this.grabs.size > 0;
|
|
11711
11719
|
}
|
|
11720
|
+
/** True when THIS hand is holding something. */
|
|
11721
|
+
isGrabbingWith(handedness) {
|
|
11722
|
+
for (const input of this.grabs.keys()) {
|
|
11723
|
+
if (input.handedness === handedness) return true;
|
|
11724
|
+
}
|
|
11725
|
+
return false;
|
|
11726
|
+
}
|
|
11712
11727
|
/**
|
|
11713
11728
|
* How an entity is currently held.
|
|
11714
11729
|
*
|
|
@@ -12268,6 +12283,7 @@ __name(applyHandMaterial, "applyHandMaterial");
|
|
|
12268
12283
|
|
|
12269
12284
|
// core/systems/XRControllerVisualSystem.ts
|
|
12270
12285
|
var RAY_LENGTH = 5;
|
|
12286
|
+
var RAY_RADIUS = 3e-3;
|
|
12271
12287
|
var SLOTS = [
|
|
12272
12288
|
{ index: 0, side: "left" },
|
|
12273
12289
|
{ index: 1, side: "right" }
|
|
@@ -12277,6 +12293,8 @@ var _XRControllerVisualSystem = class _XRControllerVisualSystem {
|
|
|
12277
12293
|
this.controllerModelFactory = new XRControllerModelFactory_js.XRControllerModelFactory();
|
|
12278
12294
|
this.handModelFactory = new XRHandModelFactory_js.XRHandModelFactory();
|
|
12279
12295
|
this.group = new THREE51__namespace.Group();
|
|
12296
|
+
/** Reused so a per-frame colour compare allocates nothing. */
|
|
12297
|
+
this.rayColorScratch = new THREE51__namespace.Color();
|
|
12280
12298
|
this.slots = /* @__PURE__ */ new Map();
|
|
12281
12299
|
this.attachedTo = null;
|
|
12282
12300
|
/** Last applied preset signature, so materials rebuild only on real change. */
|
|
@@ -12305,8 +12323,9 @@ var _XRControllerVisualSystem = class _XRControllerVisualSystem {
|
|
|
12305
12323
|
const hasHand = liveKind === null || liveKind === "hand";
|
|
12306
12324
|
visuals.controllerModel.visible = showControllers && hasController;
|
|
12307
12325
|
visuals.handModel.visible = showHands && hasHand;
|
|
12308
|
-
visuals.ray.visible = this.shouldShowRay(interactor);
|
|
12326
|
+
visuals.ray.visible = this.shouldShowRay(interactor, side);
|
|
12309
12327
|
this.fitRayToHover(visuals.ray, side);
|
|
12328
|
+
this.applyRayStyle(visuals.ray, interactor);
|
|
12310
12329
|
if (showHands && this.handMaterial) {
|
|
12311
12330
|
applyHandMaterial(visuals.handModel, this.handMaterial);
|
|
12312
12331
|
}
|
|
@@ -12382,10 +12401,23 @@ var _XRControllerVisualSystem = class _XRControllerVisualSystem {
|
|
|
12382
12401
|
* off entirely; otherwise it appears on hover/grab so it isn't permanent
|
|
12383
12402
|
* clutter implying the whole scene is clickable.
|
|
12384
12403
|
*/
|
|
12385
|
-
shouldShowRay(interactor) {
|
|
12404
|
+
shouldShowRay(interactor, side) {
|
|
12386
12405
|
if (interactor && !interactor.showRay) return false;
|
|
12387
12406
|
if (!this.interactionSystem) return true;
|
|
12388
|
-
return this.interactionSystem.
|
|
12407
|
+
return this.interactionSystem.getHoverFor(side) !== null || this.interactionSystem.isGrabbingWith(side);
|
|
12408
|
+
}
|
|
12409
|
+
/** Push the author's ray colour and thickness onto the mesh. */
|
|
12410
|
+
applyRayStyle(ray, interactor) {
|
|
12411
|
+
if (!interactor) return;
|
|
12412
|
+
const material = ray.material;
|
|
12413
|
+
if (material?.color && !material.color.equals(this.rayColorScratch.set(interactor.rayColor))) {
|
|
12414
|
+
material.color.copy(this.rayColorScratch);
|
|
12415
|
+
}
|
|
12416
|
+
const radius = Math.max(5e-4, interactor.rayThickness / 2) / RAY_RADIUS;
|
|
12417
|
+
if (ray.scale.x !== radius) {
|
|
12418
|
+
ray.scale.x = radius;
|
|
12419
|
+
ray.scale.y = radius;
|
|
12420
|
+
}
|
|
12389
12421
|
}
|
|
12390
12422
|
/**
|
|
12391
12423
|
* Stop the ray at whatever it is pointing at.
|
|
@@ -12397,7 +12429,7 @@ var _XRControllerVisualSystem = class _XRControllerVisualSystem {
|
|
|
12397
12429
|
fitRayToHover(ray, side) {
|
|
12398
12430
|
const hover = this.interactionSystem?.getHoverFor(side) ?? null;
|
|
12399
12431
|
const length = hover && Number.isFinite(hover.distance) && hover.distance > 0 ? Math.min(hover.distance, RAY_LENGTH) : RAY_LENGTH;
|
|
12400
|
-
ray.scale.z = length
|
|
12432
|
+
ray.scale.z = length;
|
|
12401
12433
|
}
|
|
12402
12434
|
/** Lazily build per-slot visuals; the device reports profiles late. */
|
|
12403
12435
|
ensureSlots(world) {
|
|
@@ -12437,22 +12469,32 @@ var _XRControllerVisualSystem = class _XRControllerVisualSystem {
|
|
|
12437
12469
|
target.add(this.group);
|
|
12438
12470
|
this.attachedTo = target;
|
|
12439
12471
|
}
|
|
12472
|
+
/**
|
|
12473
|
+
* The pointer ray.
|
|
12474
|
+
*
|
|
12475
|
+
* A cylinder rather than a `THREE.Line`, because WebGL ignores `linewidth` —
|
|
12476
|
+
* every line renders one pixel wide regardless, which is nearly invisible on a
|
|
12477
|
+
* headset. A thin mesh is the only way to get a ray with real thickness
|
|
12478
|
+
* without pulling in a line-rendering extension.
|
|
12479
|
+
*/
|
|
12440
12480
|
createRay() {
|
|
12441
|
-
const geometry = new THREE51__namespace.
|
|
12442
|
-
|
|
12443
|
-
|
|
12444
|
-
|
|
12445
|
-
const material = new THREE51__namespace.LineBasicMaterial({
|
|
12481
|
+
const geometry = new THREE51__namespace.CylinderGeometry(RAY_RADIUS, RAY_RADIUS, 1, 8, 1);
|
|
12482
|
+
geometry.rotateX(-Math.PI / 2);
|
|
12483
|
+
geometry.translate(0, 0, -0.5);
|
|
12484
|
+
const material = new THREE51__namespace.MeshBasicMaterial({
|
|
12446
12485
|
color: "#4da3ff",
|
|
12447
12486
|
transparent: true,
|
|
12448
|
-
opacity: 0.
|
|
12449
|
-
depthTest: false
|
|
12487
|
+
opacity: 0.75,
|
|
12488
|
+
depthTest: false,
|
|
12489
|
+
depthWrite: false
|
|
12450
12490
|
});
|
|
12451
|
-
const
|
|
12452
|
-
|
|
12453
|
-
|
|
12454
|
-
|
|
12455
|
-
|
|
12491
|
+
const mesh = new THREE51__namespace.Mesh(geometry, material);
|
|
12492
|
+
mesh.name = "XRPointerRay";
|
|
12493
|
+
mesh.renderOrder = 999;
|
|
12494
|
+
mesh.visible = false;
|
|
12495
|
+
mesh.raycast = () => {
|
|
12496
|
+
};
|
|
12497
|
+
return mesh;
|
|
12456
12498
|
}
|
|
12457
12499
|
dispose() {
|
|
12458
12500
|
this.group.removeFromParent();
|