@relu-interactives/spatial-ecs 0.3.21 → 0.4.1

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 (46) hide show
  1. package/dist/{System-BhnLw0fZ.d.cts → System-ln4Q7Eot.d.cts} +15 -1
  2. package/dist/{System-BhnLw0fZ.d.ts → System-ln4Q7Eot.d.ts} +15 -1
  3. package/dist/{XRHandPose-CrzI57JA.d.ts → XRHandPose-BImIa4ZS.d.ts} +82 -2
  4. package/dist/{XRHandPose-CLl4MiHx.d.cts → XRHandPose-CxPv-LBo.d.cts} +82 -2
  5. package/dist/{chunk-H6DQ7JRE.js → chunk-4AK4I3QF.js} +33 -3
  6. package/dist/chunk-4AK4I3QF.js.map +1 -0
  7. package/dist/{chunk-D6KXWNYT.js → chunk-4DWZK4X4.js} +3 -3
  8. package/dist/{chunk-D6KXWNYT.js.map → chunk-4DWZK4X4.js.map} +1 -1
  9. package/dist/{chunk-CDSE7476.js → chunk-LAOFCFEI.js} +554 -5
  10. package/dist/chunk-LAOFCFEI.js.map +1 -0
  11. package/dist/{chunk-P42OE3RU.js → chunk-SGADE55G.js} +14 -5
  12. package/dist/chunk-SGADE55G.js.map +1 -0
  13. package/dist/components/index.cjs +30 -0
  14. package/dist/components/index.cjs.map +1 -1
  15. package/dist/components/index.d.cts +3 -3
  16. package/dist/components/index.d.ts +3 -3
  17. package/dist/components/index.js +1 -1
  18. package/dist/docs/guide/mixed-reality.md +120 -0
  19. package/dist/factories/index.cjs +26 -0
  20. package/dist/factories/index.cjs.map +1 -1
  21. package/dist/factories/index.d.cts +5 -3
  22. package/dist/factories/index.d.ts +5 -3
  23. package/dist/factories/index.js +3 -3
  24. package/dist/{index-C2I5PxCI.d.cts → index-CBdnIyI8.d.cts} +94 -2
  25. package/dist/{index-g777AmFv.d.cts → index-CQsHUez3.d.cts} +42 -4
  26. package/dist/{index-JRcoel9F.d.ts → index-CuGqxuk-.d.ts} +42 -4
  27. package/dist/{index-6l4hn2Sh.d.ts → index-n7SeH119.d.ts} +94 -2
  28. package/dist/index.cjs +610 -0
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.cts +9 -8
  31. package/dist/index.d.ts +9 -8
  32. package/dist/index.js +26 -8
  33. package/dist/index.js.map +1 -1
  34. package/dist/systems/index.cjs +580 -0
  35. package/dist/systems/index.cjs.map +1 -1
  36. package/dist/systems/index.d.cts +2 -2
  37. package/dist/systems/index.d.ts +2 -2
  38. package/dist/systems/index.js +3 -3
  39. package/dist/types.d.cts +1 -1
  40. package/dist/types.d.ts +1 -1
  41. package/dist/worldSnapshotUtils.d.cts +1 -1
  42. package/dist/worldSnapshotUtils.d.ts +1 -1
  43. package/package.json +1 -1
  44. package/dist/chunk-CDSE7476.js.map +0 -1
  45. package/dist/chunk-H6DQ7JRE.js.map +0 -1
  46. package/dist/chunk-P42OE3RU.js.map +0 -1
@@ -619,7 +619,7 @@ type CreateContext = {
619
619
  isEditor?: boolean;
620
620
  };
621
621
  type EntityFactory = (context: CreateContext) => EntityId;
622
- type EcsComponentFactoryKind = "animation" | "audio" | "camera" | "environment" | "entityType" | "image" | "imageTargetAnchor" | "imageTarget" | "light" | "material" | "mesh" | "meshGeometry" | "model" | "name" | "object3DRef" | "parentId" | "physics" | "postprocessing" | "script" | "scriptObject" | "selectable" | "selectionTransformState" | "sprite" | "transform" | "video" | "instancedMesh" | "xrRig" | "vrTeleportArea" | "xrHandPose" | "xrInteractable" | "xrInteractor" | "xrInteractorSide";
622
+ type EcsComponentFactoryKind = "animation" | "audio" | "camera" | "environment" | "entityType" | "image" | "imageTargetAnchor" | "imageTarget" | "light" | "material" | "mesh" | "meshGeometry" | "model" | "name" | "object3DRef" | "parentId" | "physics" | "postprocessing" | "script" | "scriptObject" | "selectable" | "selectionTransformState" | "sprite" | "transform" | "video" | "instancedMesh" | "xrRig" | "vrTeleportArea" | "xrHandPose" | "xrAnchor" | "xrInteractable" | "xrInteractor" | "xrInteractorSide";
623
623
  type ComponentFactory = (world: World, entityId: EntityId, ...args: any[]) => unknown;
624
624
  declare class ObjectManagementSystem implements EcsSystem {
625
625
  private readonly scene;
@@ -973,6 +973,20 @@ declare class World {
973
973
  * the head pose as `parent.matrixWorld × headPose`.
974
974
  */
975
975
  isXrPresenting(): boolean;
976
+ /**
977
+ * `true` while the session is compositing over the real world (passthrough).
978
+ *
979
+ * Read from the session's `environmentBlendMode` rather than from what the app
980
+ * ASKED for: a request for `immersive-ar` can be granted as a plain opaque
981
+ * session, and the blend mode is the only thing that says what the user is
982
+ * actually looking at. `additive` (optical see-through) and `alpha-blend`
983
+ * (video passthrough) both mean the real world is visible behind the render.
984
+ *
985
+ * The load-bearing consequence is that nothing may paint an opaque background:
986
+ * a skybox drawn over the whole framebuffer hides the room completely, which
987
+ * looks exactly like passthrough having failed.
988
+ */
989
+ isXrPassthrough(): boolean;
976
990
  /**
977
991
  * Pauses world simulation. While paused, `update()` skips all system ticks so
978
992
  * physics, animation, scripts, and rendering stop advancing. The last rendered
@@ -619,7 +619,7 @@ type CreateContext = {
619
619
  isEditor?: boolean;
620
620
  };
621
621
  type EntityFactory = (context: CreateContext) => EntityId;
622
- type EcsComponentFactoryKind = "animation" | "audio" | "camera" | "environment" | "entityType" | "image" | "imageTargetAnchor" | "imageTarget" | "light" | "material" | "mesh" | "meshGeometry" | "model" | "name" | "object3DRef" | "parentId" | "physics" | "postprocessing" | "script" | "scriptObject" | "selectable" | "selectionTransformState" | "sprite" | "transform" | "video" | "instancedMesh" | "xrRig" | "vrTeleportArea" | "xrHandPose" | "xrInteractable" | "xrInteractor" | "xrInteractorSide";
622
+ type EcsComponentFactoryKind = "animation" | "audio" | "camera" | "environment" | "entityType" | "image" | "imageTargetAnchor" | "imageTarget" | "light" | "material" | "mesh" | "meshGeometry" | "model" | "name" | "object3DRef" | "parentId" | "physics" | "postprocessing" | "script" | "scriptObject" | "selectable" | "selectionTransformState" | "sprite" | "transform" | "video" | "instancedMesh" | "xrRig" | "vrTeleportArea" | "xrHandPose" | "xrAnchor" | "xrInteractable" | "xrInteractor" | "xrInteractorSide";
623
623
  type ComponentFactory = (world: World, entityId: EntityId, ...args: any[]) => unknown;
624
624
  declare class ObjectManagementSystem implements EcsSystem {
625
625
  private readonly scene;
@@ -973,6 +973,20 @@ declare class World {
973
973
  * the head pose as `parent.matrixWorld × headPose`.
974
974
  */
975
975
  isXrPresenting(): boolean;
976
+ /**
977
+ * `true` while the session is compositing over the real world (passthrough).
978
+ *
979
+ * Read from the session's `environmentBlendMode` rather than from what the app
980
+ * ASKED for: a request for `immersive-ar` can be granted as a plain opaque
981
+ * session, and the blend mode is the only thing that says what the user is
982
+ * actually looking at. `additive` (optical see-through) and `alpha-blend`
983
+ * (video passthrough) both mean the real world is visible behind the render.
984
+ *
985
+ * The load-bearing consequence is that nothing may paint an opaque background:
986
+ * a skybox drawn over the whole framebuffer hides the room completely, which
987
+ * looks exactly like passthrough having failed.
988
+ */
989
+ isXrPassthrough(): boolean;
976
990
  /**
977
991
  * Pauses world simulation. While paused, `update()` skips all system ticks so
978
992
  * physics, animation, scripts, and rendering stop advancing. The last rendered
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three';
2
- import { C as Component, p as EcsEntityKind, F as EcsEntityEditorKind, r as EntityId } from './System-BhnLw0fZ.js';
2
+ import { C as Component, p as EcsEntityKind, F as EcsEntityEditorKind, r as EntityId } from './System-ln4Q7Eot.js';
3
3
  import * as RAPIER from '@dimforge/rapier3d-compat';
4
4
  import { a as XrFinger, c as XrHandPoseDirection, b as XrHandPoseOrientation, X as XrHandPoseDefinition } from './handPose-DlcTtqgx.js';
5
5
 
@@ -1436,6 +1436,20 @@ declare function createAttachPoint(partial: Partial<XrAttachPoint> & {
1436
1436
  type XrTrackingOrigin = "floor" | "eye";
1437
1437
  /** How the player moves through the scene in an immersive session. */
1438
1438
  type XrLocomotionMode = "teleport" | "smooth" | "none";
1439
+ /**
1440
+ * Which real-world geometry becomes physics colliders in a passthrough session.
1441
+ *
1442
+ * `planes` uses the flat surfaces the headset detects (floor, walls, desks) —
1443
+ * cheap, and available on more devices. `mesh` uses the full room scan, which is
1444
+ * far more faithful (chair legs, clutter) but only exists where the runtime
1445
+ * grants `mesh-detection`. `auto` takes the mesh when it is granted and quietly
1446
+ * falls back to planes.
1447
+ *
1448
+ * `none` is the default because BOTH options make the headset ask the user for
1449
+ * permission to share a scan of their room — a prompt no project should trigger
1450
+ * unless it actually uses the result.
1451
+ */
1452
+ type XrEnvironmentPhysics = "none" | "planes" | "mesh" | "auto";
1439
1453
  /** Optional initializer for {@link XRRigComponent}. */
1440
1454
  type XRRigOptions = {
1441
1455
  /** Where the headset origin sits. Defaults to `floor`. */
@@ -1456,6 +1470,18 @@ type XRRigOptions = {
1456
1470
  teleportArcInvalidColor?: string;
1457
1471
  /** Teleport arc thickness (diameter), metres. */
1458
1472
  teleportArcThickness?: number;
1473
+ /** Run the session in passthrough (`immersive-ar`) instead of VR. */
1474
+ passthrough?: boolean;
1475
+ /** Let real objects occlude virtual ones, via WebXR depth sensing. */
1476
+ depthOcclusion?: boolean;
1477
+ /** Which detected real-world geometry becomes physics colliders. */
1478
+ environmentPhysics?: XrEnvironmentPhysics;
1479
+ /** Draw the detected room geometry on-device, for checking a scan. */
1480
+ environmentDebug?: boolean;
1481
+ /** Allow scripts to raycast against the real room (`hit-test`). */
1482
+ hitTest?: boolean;
1483
+ /** Allow content to be pinned to real-world features (`anchors`). */
1484
+ anchors?: boolean;
1459
1485
  };
1460
1486
  /**
1461
1487
  * Marks an entity as the XR rig — the player's movable origin.
@@ -1490,9 +1516,63 @@ declare class XRRigComponent extends Component {
1490
1516
  teleportArcInvalidColor: string;
1491
1517
  /** Teleport arc thickness (diameter), metres. */
1492
1518
  teleportArcThickness: number;
1519
+ /**
1520
+ * Run the session in passthrough — the real room shows through.
1521
+ *
1522
+ * This is the VR/MR switch for the whole project: the entry button requests
1523
+ * `immersive-ar` instead of `immersive-vr`. Blend mode is fixed for the life
1524
+ * of a session, so this cannot be flipped mid-session — ending and re-entering
1525
+ * is the only way to change it.
1526
+ */
1527
+ passthrough: boolean;
1528
+ /** Let real objects occlude virtual ones, via WebXR depth sensing. */
1529
+ depthOcclusion: boolean;
1530
+ /** Which detected real-world geometry becomes physics colliders. */
1531
+ environmentPhysics: XrEnvironmentPhysics;
1532
+ /** Draw the detected room geometry on-device, for checking a scan. */
1533
+ environmentDebug: boolean;
1534
+ /** Allow scripts to raycast against the real room (`hit-test`). */
1535
+ hitTest: boolean;
1536
+ /** Allow content to be pinned to real-world features (`anchors`). */
1537
+ anchors: boolean;
1493
1538
  constructor(options?: XRRigOptions);
1494
1539
  }
1495
1540
 
1541
+ /** Optional initializer for {@link XRAnchorComponent}. */
1542
+ type XRAnchorOptions = {
1543
+ /** Whether the entity should anchor at all. Defaults to `true`. */
1544
+ enabled?: boolean;
1545
+ };
1546
+ /**
1547
+ * Pins an entity to a real-world position.
1548
+ *
1549
+ * A headset's idea of where the room is keeps being refined while a session
1550
+ * runs — it re-recognises the space, corrects drift, and quietly shifts its
1551
+ * coordinate system by a few centimetres. Content placed at fixed scene
1552
+ * coordinates does not move with those corrections, so a vase carefully set on a
1553
+ * real table gradually slides off it.
1554
+ *
1555
+ * An anchor is the runtime's own handle on a point in the room. Attaching this
1556
+ * component hands the entity's pose over to that handle, so the entity moves
1557
+ * exactly as the runtime's understanding of the room moves and stays put
1558
+ * relative to the real world.
1559
+ *
1560
+ * Because the anchor OWNS the transform once created, moving the entity by
1561
+ * script or by physics has no lasting effect — release it first if you want to
1562
+ * move it, then re-anchor.
1563
+ *
1564
+ * Anchors last only as long as the session. Persisting one across launches
1565
+ * needs `requestPersistentHandle`, which is still a draft extension and not
1566
+ * supported here.
1567
+ *
1568
+ * @category Components
1569
+ */
1570
+ declare class XRAnchorComponent extends Component {
1571
+ /** Whether the entity should anchor. Turning this off releases the anchor. */
1572
+ enabled: boolean;
1573
+ constructor(options?: XRAnchorOptions);
1574
+ }
1575
+
1496
1576
  /**
1497
1577
  * What is rendered at the user's hands.
1498
1578
  *
@@ -1657,4 +1737,4 @@ declare class XRHandPoseComponent extends Component {
1657
1737
  constructor(options?: XRHandPoseOptions);
1658
1738
  }
1659
1739
 
1660
- export { Selectable as $, AnimationComponent as A, type MaterialValueState as B, CameraComponent as C, DEFAULT_COLLIDER_STATE as D, type EditableMeshObjectKind as E, MeshComponent as F, MeshGeometryComponent as G, type MeshGeometryParameters as H, ImageComponent as I, type MeshGeometryParametersByKind as J, ModelComponent as K, LightComponent as L, MaterialComponent as M, Name as N, Object3DRef as O, PhysicsComponent as P, type PhysicsState as Q, type PlaneMeshParameters as R, type RadiusHeightMeshParameters as S, type RadiusMeshParameters as T, type RigidbodyState as U, type RigidbodyType as V, ScriptComponent as W, type ScriptEntry as X, ScriptObjectComponent as Y, type ScriptObjectComponentInput as Z, type ScriptObjectRuntimeState as _, type AnimationComponentOptions as a, SelectionTransformState as a0, SpriteComponent as a1, type TextureFilteringValue as a2, type TransformModeValue as a3, type TransformSpaceValue as a4, VRTeleportAreaComponent as a5, type VRTeleportAreaOptions as a6, VideoComponent as a7, type VrTeleportShape as a8, XRHandPoseComponent as a9, type AnimationStateCallbacks as aA, AnimationStateMachine as aB, AnimationStateManager as aC, type StateMachine as aD, type XRHandPoseOptions as aa, XRInteractableComponent as ab, type XRInteractableOptions as ac, XRInteractorComponent as ad, type XRInteractorOptions as ae, XRInteractorSideComponent as af, XRRigComponent as ag, type XRRigOptions as ah, type XrAttachPoint as ai, type XrDistanceGrabBehavior as aj, type XrGrabGesture as ak, type XrGrabHands as al, type XrGrabReach as am, type XrHandPoseEntry as an, type XrHandPreset as ao, type XrInteractorSide as ap, type XrInteractorType as aq, type XrLocomotionMode as ar, type XrTrackingOrigin as as, type XrTwoHandRotation as at, createAttachPoint as au, createHandPoseEntry as av, defaultMaterialValue as aw, handPoseDefinitionFor as ax, normalizePhysicsState as ay, setPhysicsLiveRef as az, AudioComponent as b, type CameraComponentOptions as c, type CameraProjection as d, type CameraRuntimeType as e, type ColliderShape as f, type ColliderState as g, type CubeMeshParameters as h, DEFAULT_INSTANCED_MESH_PARAMETERS as i, DEFAULT_INSTANCE_TRANSFORM as j, DEFAULT_MESH_GEOMETRY_PARAMETERS as k, DEFAULT_PHYSICS_STATE as l, DEFAULT_POSE_CURLS as m, DEFAULT_POSE_DIRECTIONS as n, DEFAULT_RIGIDBODY_STATE as o, EntityType as p, ImageTarget as q, ImageTargetAnchor as r, type ImageTargetAnchorOptions as s, type ImageTargetReference as t, InstanceSlotComponent as u, type InstanceTransform as v, InstancedMeshComponent as w, type InstancedMeshKind as x, type LightValueState as y, type MaterialTypeValue as z };
1740
+ export { Selectable as $, AnimationComponent as A, type MaterialValueState as B, CameraComponent as C, DEFAULT_COLLIDER_STATE as D, type EditableMeshObjectKind as E, MeshComponent as F, MeshGeometryComponent as G, type MeshGeometryParameters as H, ImageComponent as I, type MeshGeometryParametersByKind as J, ModelComponent as K, LightComponent as L, MaterialComponent as M, Name as N, Object3DRef as O, PhysicsComponent as P, type PhysicsState as Q, type PlaneMeshParameters as R, type RadiusHeightMeshParameters as S, type RadiusMeshParameters as T, type RigidbodyState as U, type RigidbodyType as V, ScriptComponent as W, type ScriptEntry as X, ScriptObjectComponent as Y, type ScriptObjectComponentInput as Z, type ScriptObjectRuntimeState as _, type AnimationComponentOptions as a, SelectionTransformState as a0, SpriteComponent as a1, type TextureFilteringValue as a2, type TransformModeValue as a3, type TransformSpaceValue as a4, VRTeleportAreaComponent as a5, type VRTeleportAreaOptions as a6, VideoComponent as a7, type VrTeleportShape as a8, XRAnchorComponent as a9, handPoseDefinitionFor as aA, normalizePhysicsState as aB, setPhysicsLiveRef as aC, type AnimationStateCallbacks as aD, AnimationStateMachine as aE, AnimationStateManager as aF, type StateMachine as aG, type XRAnchorOptions as aa, XRHandPoseComponent as ab, type XRHandPoseOptions as ac, XRInteractableComponent as ad, type XRInteractableOptions as ae, XRInteractorComponent as af, type XRInteractorOptions as ag, XRInteractorSideComponent as ah, XRRigComponent as ai, type XRRigOptions as aj, type XrAttachPoint as ak, type XrDistanceGrabBehavior as al, type XrEnvironmentPhysics as am, type XrGrabGesture as an, type XrGrabHands as ao, type XrGrabReach as ap, type XrHandPoseEntry as aq, type XrHandPreset as ar, type XrInteractorSide as as, type XrInteractorType as at, type XrLocomotionMode as au, type XrTrackingOrigin as av, type XrTwoHandRotation as aw, createAttachPoint as ax, createHandPoseEntry as ay, defaultMaterialValue as az, AudioComponent as b, type CameraComponentOptions as c, type CameraProjection as d, type CameraRuntimeType as e, type ColliderShape as f, type ColliderState as g, type CubeMeshParameters as h, DEFAULT_INSTANCED_MESH_PARAMETERS as i, DEFAULT_INSTANCE_TRANSFORM as j, DEFAULT_MESH_GEOMETRY_PARAMETERS as k, DEFAULT_PHYSICS_STATE as l, DEFAULT_POSE_CURLS as m, DEFAULT_POSE_DIRECTIONS as n, DEFAULT_RIGIDBODY_STATE as o, EntityType as p, ImageTarget as q, ImageTargetAnchor as r, type ImageTargetAnchorOptions as s, type ImageTargetReference as t, InstanceSlotComponent as u, type InstanceTransform as v, InstancedMeshComponent as w, type InstancedMeshKind as x, type LightValueState as y, type MaterialTypeValue as z };
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three';
2
- import { C as Component, p as EcsEntityKind, F as EcsEntityEditorKind, r as EntityId } from './System-BhnLw0fZ.cjs';
2
+ import { C as Component, p as EcsEntityKind, F as EcsEntityEditorKind, r as EntityId } from './System-ln4Q7Eot.cjs';
3
3
  import * as RAPIER from '@dimforge/rapier3d-compat';
4
4
  import { a as XrFinger, c as XrHandPoseDirection, b as XrHandPoseOrientation, X as XrHandPoseDefinition } from './handPose-DlcTtqgx.cjs';
5
5
 
@@ -1436,6 +1436,20 @@ declare function createAttachPoint(partial: Partial<XrAttachPoint> & {
1436
1436
  type XrTrackingOrigin = "floor" | "eye";
1437
1437
  /** How the player moves through the scene in an immersive session. */
1438
1438
  type XrLocomotionMode = "teleport" | "smooth" | "none";
1439
+ /**
1440
+ * Which real-world geometry becomes physics colliders in a passthrough session.
1441
+ *
1442
+ * `planes` uses the flat surfaces the headset detects (floor, walls, desks) —
1443
+ * cheap, and available on more devices. `mesh` uses the full room scan, which is
1444
+ * far more faithful (chair legs, clutter) but only exists where the runtime
1445
+ * grants `mesh-detection`. `auto` takes the mesh when it is granted and quietly
1446
+ * falls back to planes.
1447
+ *
1448
+ * `none` is the default because BOTH options make the headset ask the user for
1449
+ * permission to share a scan of their room — a prompt no project should trigger
1450
+ * unless it actually uses the result.
1451
+ */
1452
+ type XrEnvironmentPhysics = "none" | "planes" | "mesh" | "auto";
1439
1453
  /** Optional initializer for {@link XRRigComponent}. */
1440
1454
  type XRRigOptions = {
1441
1455
  /** Where the headset origin sits. Defaults to `floor`. */
@@ -1456,6 +1470,18 @@ type XRRigOptions = {
1456
1470
  teleportArcInvalidColor?: string;
1457
1471
  /** Teleport arc thickness (diameter), metres. */
1458
1472
  teleportArcThickness?: number;
1473
+ /** Run the session in passthrough (`immersive-ar`) instead of VR. */
1474
+ passthrough?: boolean;
1475
+ /** Let real objects occlude virtual ones, via WebXR depth sensing. */
1476
+ depthOcclusion?: boolean;
1477
+ /** Which detected real-world geometry becomes physics colliders. */
1478
+ environmentPhysics?: XrEnvironmentPhysics;
1479
+ /** Draw the detected room geometry on-device, for checking a scan. */
1480
+ environmentDebug?: boolean;
1481
+ /** Allow scripts to raycast against the real room (`hit-test`). */
1482
+ hitTest?: boolean;
1483
+ /** Allow content to be pinned to real-world features (`anchors`). */
1484
+ anchors?: boolean;
1459
1485
  };
1460
1486
  /**
1461
1487
  * Marks an entity as the XR rig — the player's movable origin.
@@ -1490,9 +1516,63 @@ declare class XRRigComponent extends Component {
1490
1516
  teleportArcInvalidColor: string;
1491
1517
  /** Teleport arc thickness (diameter), metres. */
1492
1518
  teleportArcThickness: number;
1519
+ /**
1520
+ * Run the session in passthrough — the real room shows through.
1521
+ *
1522
+ * This is the VR/MR switch for the whole project: the entry button requests
1523
+ * `immersive-ar` instead of `immersive-vr`. Blend mode is fixed for the life
1524
+ * of a session, so this cannot be flipped mid-session — ending and re-entering
1525
+ * is the only way to change it.
1526
+ */
1527
+ passthrough: boolean;
1528
+ /** Let real objects occlude virtual ones, via WebXR depth sensing. */
1529
+ depthOcclusion: boolean;
1530
+ /** Which detected real-world geometry becomes physics colliders. */
1531
+ environmentPhysics: XrEnvironmentPhysics;
1532
+ /** Draw the detected room geometry on-device, for checking a scan. */
1533
+ environmentDebug: boolean;
1534
+ /** Allow scripts to raycast against the real room (`hit-test`). */
1535
+ hitTest: boolean;
1536
+ /** Allow content to be pinned to real-world features (`anchors`). */
1537
+ anchors: boolean;
1493
1538
  constructor(options?: XRRigOptions);
1494
1539
  }
1495
1540
 
1541
+ /** Optional initializer for {@link XRAnchorComponent}. */
1542
+ type XRAnchorOptions = {
1543
+ /** Whether the entity should anchor at all. Defaults to `true`. */
1544
+ enabled?: boolean;
1545
+ };
1546
+ /**
1547
+ * Pins an entity to a real-world position.
1548
+ *
1549
+ * A headset's idea of where the room is keeps being refined while a session
1550
+ * runs — it re-recognises the space, corrects drift, and quietly shifts its
1551
+ * coordinate system by a few centimetres. Content placed at fixed scene
1552
+ * coordinates does not move with those corrections, so a vase carefully set on a
1553
+ * real table gradually slides off it.
1554
+ *
1555
+ * An anchor is the runtime's own handle on a point in the room. Attaching this
1556
+ * component hands the entity's pose over to that handle, so the entity moves
1557
+ * exactly as the runtime's understanding of the room moves and stays put
1558
+ * relative to the real world.
1559
+ *
1560
+ * Because the anchor OWNS the transform once created, moving the entity by
1561
+ * script or by physics has no lasting effect — release it first if you want to
1562
+ * move it, then re-anchor.
1563
+ *
1564
+ * Anchors last only as long as the session. Persisting one across launches
1565
+ * needs `requestPersistentHandle`, which is still a draft extension and not
1566
+ * supported here.
1567
+ *
1568
+ * @category Components
1569
+ */
1570
+ declare class XRAnchorComponent extends Component {
1571
+ /** Whether the entity should anchor. Turning this off releases the anchor. */
1572
+ enabled: boolean;
1573
+ constructor(options?: XRAnchorOptions);
1574
+ }
1575
+
1496
1576
  /**
1497
1577
  * What is rendered at the user's hands.
1498
1578
  *
@@ -1657,4 +1737,4 @@ declare class XRHandPoseComponent extends Component {
1657
1737
  constructor(options?: XRHandPoseOptions);
1658
1738
  }
1659
1739
 
1660
- export { Selectable as $, AnimationComponent as A, type MaterialValueState as B, CameraComponent as C, DEFAULT_COLLIDER_STATE as D, type EditableMeshObjectKind as E, MeshComponent as F, MeshGeometryComponent as G, type MeshGeometryParameters as H, ImageComponent as I, type MeshGeometryParametersByKind as J, ModelComponent as K, LightComponent as L, MaterialComponent as M, Name as N, Object3DRef as O, PhysicsComponent as P, type PhysicsState as Q, type PlaneMeshParameters as R, type RadiusHeightMeshParameters as S, type RadiusMeshParameters as T, type RigidbodyState as U, type RigidbodyType as V, ScriptComponent as W, type ScriptEntry as X, ScriptObjectComponent as Y, type ScriptObjectComponentInput as Z, type ScriptObjectRuntimeState as _, type AnimationComponentOptions as a, SelectionTransformState as a0, SpriteComponent as a1, type TextureFilteringValue as a2, type TransformModeValue as a3, type TransformSpaceValue as a4, VRTeleportAreaComponent as a5, type VRTeleportAreaOptions as a6, VideoComponent as a7, type VrTeleportShape as a8, XRHandPoseComponent as a9, type AnimationStateCallbacks as aA, AnimationStateMachine as aB, AnimationStateManager as aC, type StateMachine as aD, type XRHandPoseOptions as aa, XRInteractableComponent as ab, type XRInteractableOptions as ac, XRInteractorComponent as ad, type XRInteractorOptions as ae, XRInteractorSideComponent as af, XRRigComponent as ag, type XRRigOptions as ah, type XrAttachPoint as ai, type XrDistanceGrabBehavior as aj, type XrGrabGesture as ak, type XrGrabHands as al, type XrGrabReach as am, type XrHandPoseEntry as an, type XrHandPreset as ao, type XrInteractorSide as ap, type XrInteractorType as aq, type XrLocomotionMode as ar, type XrTrackingOrigin as as, type XrTwoHandRotation as at, createAttachPoint as au, createHandPoseEntry as av, defaultMaterialValue as aw, handPoseDefinitionFor as ax, normalizePhysicsState as ay, setPhysicsLiveRef as az, AudioComponent as b, type CameraComponentOptions as c, type CameraProjection as d, type CameraRuntimeType as e, type ColliderShape as f, type ColliderState as g, type CubeMeshParameters as h, DEFAULT_INSTANCED_MESH_PARAMETERS as i, DEFAULT_INSTANCE_TRANSFORM as j, DEFAULT_MESH_GEOMETRY_PARAMETERS as k, DEFAULT_PHYSICS_STATE as l, DEFAULT_POSE_CURLS as m, DEFAULT_POSE_DIRECTIONS as n, DEFAULT_RIGIDBODY_STATE as o, EntityType as p, ImageTarget as q, ImageTargetAnchor as r, type ImageTargetAnchorOptions as s, type ImageTargetReference as t, InstanceSlotComponent as u, type InstanceTransform as v, InstancedMeshComponent as w, type InstancedMeshKind as x, type LightValueState as y, type MaterialTypeValue as z };
1740
+ export { Selectable as $, AnimationComponent as A, type MaterialValueState as B, CameraComponent as C, DEFAULT_COLLIDER_STATE as D, type EditableMeshObjectKind as E, MeshComponent as F, MeshGeometryComponent as G, type MeshGeometryParameters as H, ImageComponent as I, type MeshGeometryParametersByKind as J, ModelComponent as K, LightComponent as L, MaterialComponent as M, Name as N, Object3DRef as O, PhysicsComponent as P, type PhysicsState as Q, type PlaneMeshParameters as R, type RadiusHeightMeshParameters as S, type RadiusMeshParameters as T, type RigidbodyState as U, type RigidbodyType as V, ScriptComponent as W, type ScriptEntry as X, ScriptObjectComponent as Y, type ScriptObjectComponentInput as Z, type ScriptObjectRuntimeState as _, type AnimationComponentOptions as a, SelectionTransformState as a0, SpriteComponent as a1, type TextureFilteringValue as a2, type TransformModeValue as a3, type TransformSpaceValue as a4, VRTeleportAreaComponent as a5, type VRTeleportAreaOptions as a6, VideoComponent as a7, type VrTeleportShape as a8, XRAnchorComponent as a9, handPoseDefinitionFor as aA, normalizePhysicsState as aB, setPhysicsLiveRef as aC, type AnimationStateCallbacks as aD, AnimationStateMachine as aE, AnimationStateManager as aF, type StateMachine as aG, type XRAnchorOptions as aa, XRHandPoseComponent as ab, type XRHandPoseOptions as ac, XRInteractableComponent as ad, type XRInteractableOptions as ae, XRInteractorComponent as af, type XRInteractorOptions as ag, XRInteractorSideComponent as ah, XRRigComponent as ai, type XRRigOptions as aj, type XrAttachPoint as ak, type XrDistanceGrabBehavior as al, type XrEnvironmentPhysics as am, type XrGrabGesture as an, type XrGrabHands as ao, type XrGrabReach as ap, type XrHandPoseEntry as aq, type XrHandPreset as ar, type XrInteractorSide as as, type XrInteractorType as at, type XrLocomotionMode as au, type XrTrackingOrigin as av, type XrTwoHandRotation as aw, createAttachPoint as ax, createHandPoseEntry as ay, defaultMaterialValue as az, AudioComponent as b, type CameraComponentOptions as c, type CameraProjection as d, type CameraRuntimeType as e, type ColliderShape as f, type ColliderState as g, type CubeMeshParameters as h, DEFAULT_INSTANCED_MESH_PARAMETERS as i, DEFAULT_INSTANCE_TRANSFORM as j, DEFAULT_MESH_GEOMETRY_PARAMETERS as k, DEFAULT_PHYSICS_STATE as l, DEFAULT_POSE_CURLS as m, DEFAULT_POSE_DIRECTIONS as n, DEFAULT_RIGIDBODY_STATE as o, EntityType as p, ImageTarget as q, ImageTargetAnchor as r, type ImageTargetAnchorOptions as s, type ImageTargetReference as t, InstanceSlotComponent as u, type InstanceTransform as v, InstancedMeshComponent as w, type InstancedMeshKind as x, type LightValueState as y, type MaterialTypeValue as z };
@@ -45,6 +45,8 @@ __export(components_exports, {
45
45
  TransformComponent: () => TransformComponent,
46
46
  VRTeleportAreaComponent: () => VRTeleportAreaComponent,
47
47
  VideoComponent: () => VideoComponent,
48
+ XRAnchorComponent: () => XRAnchorComponent,
49
+ XREnvironmentComponent: () => XREnvironmentComponent,
48
50
  XRHandPoseComponent: () => XRHandPoseComponent,
49
51
  XRInteractableComponent: () => XRInteractableComponent,
50
52
  XRInteractorComponent: () => XRInteractorComponent,
@@ -1999,11 +2001,39 @@ var _XRRigComponent = class _XRRigComponent extends Component {
1999
2001
  this.teleportArcColor = options?.teleportArcColor ?? "#4da3ff";
2000
2002
  this.teleportArcInvalidColor = options?.teleportArcInvalidColor ?? "#ff5a5a";
2001
2003
  this.teleportArcThickness = options?.teleportArcThickness ?? 0.012;
2004
+ this.passthrough = options?.passthrough ?? false;
2005
+ this.depthOcclusion = options?.depthOcclusion ?? false;
2006
+ this.environmentPhysics = options?.environmentPhysics ?? "none";
2007
+ this.environmentDebug = options?.environmentDebug ?? false;
2008
+ this.hitTest = options?.hitTest ?? false;
2009
+ this.anchors = options?.anchors ?? false;
2002
2010
  }
2003
2011
  };
2004
2012
  __name(_XRRigComponent, "XRRigComponent");
2005
2013
  var XRRigComponent = _XRRigComponent;
2006
2014
 
2015
+ // core/components/XREnvironment.ts
2016
+ var _XREnvironmentComponent = class _XREnvironmentComponent extends Component {
2017
+ constructor(kind, semanticLabel = null, orientation = null) {
2018
+ super();
2019
+ this.kind = kind;
2020
+ this.semanticLabel = semanticLabel;
2021
+ this.orientation = orientation;
2022
+ }
2023
+ };
2024
+ __name(_XREnvironmentComponent, "XREnvironmentComponent");
2025
+ var XREnvironmentComponent = _XREnvironmentComponent;
2026
+
2027
+ // core/components/XRAnchor.ts
2028
+ var _XRAnchorComponent = class _XRAnchorComponent extends Component {
2029
+ constructor(options) {
2030
+ super();
2031
+ this.enabled = options?.enabled ?? true;
2032
+ }
2033
+ };
2034
+ __name(_XRAnchorComponent, "XRAnchorComponent");
2035
+ var XRAnchorComponent = _XRAnchorComponent;
2036
+
2007
2037
  // core/components/XRInteractor.ts
2008
2038
  var _XRInteractorComponent = class _XRInteractorComponent extends Component {
2009
2039
  constructor(options) {
@@ -2262,6 +2292,6 @@ var _XRHandPoseComponent = class _XRHandPoseComponent extends Component {
2262
2292
  __name(_XRHandPoseComponent, "XRHandPoseComponent");
2263
2293
  var XRHandPoseComponent = _XRHandPoseComponent;
2264
2294
 
2265
- export { AnimationComponent, AnimationStateMachine, AnimationStateManager, AudioComponent, CameraComponent, DEFAULT_COLLIDER_STATE, DEFAULT_ENVIRONMENT_STATE, DEFAULT_INSTANCED_MESH_PARAMETERS, DEFAULT_INSTANCE_TRANSFORM, DEFAULT_MESH_GEOMETRY_PARAMETERS, DEFAULT_PHYSICS_STATE, DEFAULT_POSE_CURLS, DEFAULT_POSE_DIRECTIONS, DEFAULT_POSTPROCESSING_STATE, DEFAULT_RIGIDBODY_STATE, EntityType, Environment, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, ImageComponent, ImageTarget, ImageTargetAnchor, InstanceSlotComponent, InstancedMeshComponent, LightComponent, MaterialComponent, MeshComponent, MeshGeometryComponent, ModelComponent, Name, Object3DRef, ParentId, PhysicsComponent, Postprocessing, PrefabInstance, PrefabNode, ScriptComponent, ScriptObjectComponent, Selectable, SelectionTransformState, SpriteComponent, TransformComponent, VRTeleportAreaComponent, VideoComponent, XRHandPoseComponent, XRInteractableComponent, XRInteractorComponent, XRInteractorSideComponent, XRRigComponent, cloneHandPose, components_exports, createAttachPoint, createHandPoseEntry, defaultMaterialValue, getHandPosePreset, handPoseDefinitionFor, handPoseFromCurls, normalizePhysicsState, setPhysicsLiveRef };
2266
- //# sourceMappingURL=chunk-H6DQ7JRE.js.map
2267
- //# sourceMappingURL=chunk-H6DQ7JRE.js.map
2295
+ export { AnimationComponent, AnimationStateMachine, AnimationStateManager, AudioComponent, CameraComponent, DEFAULT_COLLIDER_STATE, DEFAULT_ENVIRONMENT_STATE, DEFAULT_INSTANCED_MESH_PARAMETERS, DEFAULT_INSTANCE_TRANSFORM, DEFAULT_MESH_GEOMETRY_PARAMETERS, DEFAULT_PHYSICS_STATE, DEFAULT_POSE_CURLS, DEFAULT_POSE_DIRECTIONS, DEFAULT_POSTPROCESSING_STATE, DEFAULT_RIGIDBODY_STATE, EntityType, Environment, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, ImageComponent, ImageTarget, ImageTargetAnchor, InstanceSlotComponent, InstancedMeshComponent, LightComponent, MaterialComponent, MeshComponent, MeshGeometryComponent, ModelComponent, Name, Object3DRef, ParentId, PhysicsComponent, Postprocessing, PrefabInstance, PrefabNode, ScriptComponent, ScriptObjectComponent, Selectable, SelectionTransformState, SpriteComponent, TransformComponent, VRTeleportAreaComponent, VideoComponent, XRAnchorComponent, XREnvironmentComponent, XRHandPoseComponent, XRInteractableComponent, XRInteractorComponent, XRInteractorSideComponent, XRRigComponent, cloneHandPose, components_exports, createAttachPoint, createHandPoseEntry, defaultMaterialValue, getHandPosePreset, handPoseDefinitionFor, handPoseFromCurls, normalizePhysicsState, setPhysicsLiveRef };
2296
+ //# sourceMappingURL=chunk-4AK4I3QF.js.map
2297
+ //# sourceMappingURL=chunk-4AK4I3QF.js.map