@relu-interactives/spatial-ecs 0.5.0 → 0.5.2

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/index.d.cts CHANGED
@@ -3,8 +3,8 @@ export { A as AssetInput, t as CheckboxInput, u as ColorInput, v as ComponentFac
3
3
  import * as THREE from 'three';
4
4
  import { O as Object3DRef, aE as XrHandPreset } from './XRHandPose-CQTLGxFC.cjs';
5
5
  export { aQ as AnimationStateCallbacks, aR as AnimationStateMachine, aS as AnimationStateManager, aT as StateMachine } from './XRHandPose-CQTLGxFC.cjs';
6
- import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-I2IsocYW.cjs';
7
- export { A as AnimationSystem, c as AudioSystem, C as CameraSyncSystem, E as EnvironmentSyncSystem, I as InstancedMeshSystem, L as LightSyncSystem, M as MaterialSyncSystem, d as MeshGeometrySystem, e as ModuleLoader, N as NO_XR_CAPABILITIES, O as ObjectVisibilitySystem, P as PhysicsSyncSystem, f as PostprocessingSyncSystem, S as SCRIPT_OBJECT_ROOT_FLAG, g as ScriptBehaviourSystem, h as ScriptObjectSystem, i as SelectionContext, U as UIInteractionSystem, j as UIPanelSystem, k as UiCanvasLike, V as VRTeleportAreaSystem, l as VideoSystem, m as XRAnchorSystem, n as XRControllerVisualSystem, o as XREnvironmentSystem, p as XRHandPoseSystem, q as XRHitTestSystem, r as XRHoverVisualSystem, s as XRInputSystem, t as XRInteractionSystem, u as XRLocomotionSystem, v as XRSessionSystem, w as XRTeleportVisualSystem, x as XR_HOVER_SHELL_FLAG, y as XrHandedness, z as XrHitResult, B as XrInputKind, D as readXrCapabilities } from './index-I2IsocYW.cjs';
6
+ import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-DaG03vyN.cjs';
7
+ export { A as AnimationSystem, c as AudioSystem, C as CameraSyncSystem, E as EnvironmentSyncSystem, I as InstancedMeshSystem, L as LightSyncSystem, M as MaterialSyncSystem, d as MeshGeometrySystem, e as ModuleLoader, N as NO_XR_CAPABILITIES, O as ObjectVisibilitySystem, P as PhysicsSyncSystem, f as PostprocessingSyncSystem, S as SCRIPT_OBJECT_ROOT_FLAG, g as ScriptBehaviourSystem, h as ScriptObjectSystem, i as SelectionContext, U as UIInteractionSystem, j as UIPanelSystem, k as UiCanvasLike, V as VRTeleportAreaSystem, l as VideoSystem, m as XRAnchorSystem, n as XRControllerVisualSystem, o as XREnvironmentSystem, p as XRHandPoseSystem, q as XRHitTestSystem, r as XRHoverVisualSystem, s as XRInputSystem, t as XRInteractionSystem, u as XRLocomotionSystem, v as XRSessionSystem, w as XRTeleportVisualSystem, x as XR_HOVER_SHELL_FLAG, y as XrHandedness, z as XrHitResult, B as XrInputKind, D as readXrCapabilities } from './index-DaG03vyN.cjs';
8
8
  export { i as CoreComponents } from './index-Dlr-7-4m.cjs';
9
9
  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, createUIButtonComponent, createUIPanelComponent, createUISliderComponent, createUITextComponent, createUIToggleComponent, createVRTeleportAreaComponent, createVideoComponent, createXRAnchorComponent, createXRHandPoseComponent, createXRInteractableComponent, createXRInteractorComponent, createXRInteractorSideComponent, createXRRigComponent, registerDefaultComponentFactories, registerDefaultFactories } from './factories/index.cjs';
10
10
  import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader.js';
package/dist/index.d.ts CHANGED
@@ -3,8 +3,8 @@ export { A as AssetInput, t as CheckboxInput, u as ColorInput, v as ComponentFac
3
3
  import * as THREE from 'three';
4
4
  import { O as Object3DRef, aE as XrHandPreset } from './XRHandPose-CU3vNFuS.js';
5
5
  export { aQ as AnimationStateCallbacks, aR as AnimationStateMachine, aS as AnimationStateManager, aT as StateMachine } from './XRHandPose-CU3vNFuS.js';
6
- import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-CppKDxbu.js';
7
- export { A as AnimationSystem, c as AudioSystem, C as CameraSyncSystem, E as EnvironmentSyncSystem, I as InstancedMeshSystem, L as LightSyncSystem, M as MaterialSyncSystem, d as MeshGeometrySystem, e as ModuleLoader, N as NO_XR_CAPABILITIES, O as ObjectVisibilitySystem, P as PhysicsSyncSystem, f as PostprocessingSyncSystem, S as SCRIPT_OBJECT_ROOT_FLAG, g as ScriptBehaviourSystem, h as ScriptObjectSystem, i as SelectionContext, U as UIInteractionSystem, j as UIPanelSystem, k as UiCanvasLike, V as VRTeleportAreaSystem, l as VideoSystem, m as XRAnchorSystem, n as XRControllerVisualSystem, o as XREnvironmentSystem, p as XRHandPoseSystem, q as XRHitTestSystem, r as XRHoverVisualSystem, s as XRInputSystem, t as XRInteractionSystem, u as XRLocomotionSystem, v as XRSessionSystem, w as XRTeleportVisualSystem, x as XR_HOVER_SHELL_FLAG, y as XrHandedness, z as XrHitResult, B as XrInputKind, D as readXrCapabilities } from './index-CppKDxbu.js';
6
+ import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-D2Jt_JzH.js';
7
+ export { A as AnimationSystem, c as AudioSystem, C as CameraSyncSystem, E as EnvironmentSyncSystem, I as InstancedMeshSystem, L as LightSyncSystem, M as MaterialSyncSystem, d as MeshGeometrySystem, e as ModuleLoader, N as NO_XR_CAPABILITIES, O as ObjectVisibilitySystem, P as PhysicsSyncSystem, f as PostprocessingSyncSystem, S as SCRIPT_OBJECT_ROOT_FLAG, g as ScriptBehaviourSystem, h as ScriptObjectSystem, i as SelectionContext, U as UIInteractionSystem, j as UIPanelSystem, k as UiCanvasLike, V as VRTeleportAreaSystem, l as VideoSystem, m as XRAnchorSystem, n as XRControllerVisualSystem, o as XREnvironmentSystem, p as XRHandPoseSystem, q as XRHitTestSystem, r as XRHoverVisualSystem, s as XRInputSystem, t as XRInteractionSystem, u as XRLocomotionSystem, v as XRSessionSystem, w as XRTeleportVisualSystem, x as XR_HOVER_SHELL_FLAG, y as XrHandedness, z as XrHitResult, B as XrInputKind, D as readXrCapabilities } from './index-D2Jt_JzH.js';
8
8
  export { i as CoreComponents } from './index-C3ik3sA1.js';
9
9
  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, createUIButtonComponent, createUIPanelComponent, createUISliderComponent, createUITextComponent, createUIToggleComponent, createVRTeleportAreaComponent, createVideoComponent, createXRAnchorComponent, createXRHandPoseComponent, createXRInteractableComponent, createXRInteractorComponent, createXRInteractorSideComponent, createXRRigComponent, registerDefaultComponentFactories, registerDefaultFactories } from './factories/index.js';
10
10
  import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader.js';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { MeshGeometrySystem, InstancedMeshSystem, EnvironmentSyncSystem, PostprocessingSyncSystem, LightSyncSystem, MaterialSyncSystem, VRTeleportAreaSystem, UIPanelSystem, PhysicsSyncSystem, AnimationSystem, AudioSystem, VideoSystem, CameraSyncSystem, TransformSyncSystem, ObjectVisibilitySystem, RenderSystem, spawnPrefab, despawnPrefab, buildNodeKeyMapsFromSnapshot, indexSnapshotByEntity, findTopLevelNestedRegions, collectSnapshotSubtreeIds, groupOverridePaths, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, canonicalizeComponentValue, mergeComponentValue, decanonicalizeComponentValue, computeInstanceOverrides, collectEntitySubtree, ADDED_NODE_MARKER_COMPONENT } from './chunk-Z6ZMR3CS.js';
2
- export { ADDED_NODE_MARKER_COMPONENT, ARC_GRAVITY, ARC_MAX_TIME, ARC_SPEED, ARC_STEPS, AnimationSystem, AudioSystem, Behaviour, CURLED_COS, CameraSyncSystem, DEFAULT_DIRECTION_TOLERANCE, DEFAULT_ENTER_CONFIDENCE, DEFAULT_EXIT_CONFIDENCE, DEFAULT_LOST_GRACE_SECONDS, DEFAULT_MIN_HOLD_SECONDS, EnvironmentSyncSystem, FALLBACK_HAND_SCALE, HYDRATABLE_ENTITY_KINDS, HandPoseTracker, InputSystem, InstancedMeshSystem, KeyboardKeys, LightSyncSystem, MATCH_FALLOFF, MAX_PLAUSIBLE_SPEED, MAX_SAMPLE_AGE_SECONDS, MaterialSyncSystem, MeshGeometrySystem, NODE_KEY_SEPARATOR, NO_XR_CAPABILITIES, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, ObjectVisibilitySystem, PINCH_FINGERS, PREFAB_FILE_VERSION, PREFAB_FILE_VERSION_NESTED, PhysicsSyncSystem, PostprocessingSyncSystem, RenderSystem, SCRIPT_OBJECT_ROOT_FLAG, STRAIGHT_COS, ScriptBehaviourSystem, ScriptObject, ScriptObjectSystem, TeleportAimGate, ThrowVelocityTracker, TransformSyncSystem, UIInteractionSystem, UIPanelSystem, VELOCITY_SAMPLES, VRTeleportAreaSystem, VideoSystem, XRAnchorSystem, XRControllerVisualSystem, XREnvironmentSystem, XRHandPoseSystem, XRHitTestSystem, XRHoverVisualSystem, XRInputSystem, XRInteractionSystem, XRLocomotionSystem, XRSessionSystem, XRTeleportVisualSystem, XR_FINGERS, XR_HOVER_SHELL_FLAG, angularVelocityFrom, applyHandMaterial, arcGroundCrossing, buildComponentValueMaps, buildNodeKeyMapsFromSnapshot, buildNodeMapsFromSnapshot, canonicalizeComponentValue, clearPrefabCache, collectDiffPaths, collectEntitySubtree, collectSnapshotSubtreeIds, computeFingerCurl, computeHandShape, computeInstanceOverrides, computePalmPose, computePalmWidth, computePinch, computeSpread, createHandMaterial, decanonicalizeComponentValue, despawnPrefab, encodeOverride, estimateHandScale, findSnapshotRootEntityIds, findTopLevelNestedRegions, groupOverridePaths, hydrateWorldFromSnapshot, hydrateWorldFromSnapshotDetailed, indexSnapshotByEntity, instantiateSubtree, loadPrefab, matchHandPose, mergeComponentValue, parseOverride, parsePrefabAsset, prefabFileVersionFor, readXrCapabilities, restoreComponentState, restorePostCreateComponents, sampleTeleportArc, setPrefabAssetUrlResolver, spawnPrefab } from './chunk-Z6ZMR3CS.js';
1
+ import { MeshGeometrySystem, InstancedMeshSystem, EnvironmentSyncSystem, PostprocessingSyncSystem, LightSyncSystem, MaterialSyncSystem, VRTeleportAreaSystem, UIPanelSystem, PhysicsSyncSystem, AnimationSystem, AudioSystem, VideoSystem, CameraSyncSystem, TransformSyncSystem, ObjectVisibilitySystem, RenderSystem, spawnPrefab, despawnPrefab, buildNodeKeyMapsFromSnapshot, indexSnapshotByEntity, findTopLevelNestedRegions, collectSnapshotSubtreeIds, groupOverridePaths, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, canonicalizeComponentValue, mergeComponentValue, decanonicalizeComponentValue, computeInstanceOverrides, collectEntitySubtree, ADDED_NODE_MARKER_COMPONENT } from './chunk-DF5SSRN6.js';
2
+ export { ADDED_NODE_MARKER_COMPONENT, ARC_GRAVITY, ARC_MAX_TIME, ARC_SPEED, ARC_STEPS, AnimationSystem, AudioSystem, Behaviour, CURLED_COS, CameraSyncSystem, DEFAULT_DIRECTION_TOLERANCE, DEFAULT_ENTER_CONFIDENCE, DEFAULT_EXIT_CONFIDENCE, DEFAULT_LOST_GRACE_SECONDS, DEFAULT_MIN_HOLD_SECONDS, EnvironmentSyncSystem, FALLBACK_HAND_SCALE, HYDRATABLE_ENTITY_KINDS, HandPoseTracker, InputSystem, InstancedMeshSystem, KeyboardKeys, LightSyncSystem, MATCH_FALLOFF, MAX_PLAUSIBLE_SPEED, MAX_SAMPLE_AGE_SECONDS, MaterialSyncSystem, MeshGeometrySystem, NODE_KEY_SEPARATOR, NO_XR_CAPABILITIES, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, ObjectVisibilitySystem, PINCH_FINGERS, PREFAB_FILE_VERSION, PREFAB_FILE_VERSION_NESTED, PhysicsSyncSystem, PostprocessingSyncSystem, RenderSystem, SCRIPT_OBJECT_ROOT_FLAG, STRAIGHT_COS, ScriptBehaviourSystem, ScriptObject, ScriptObjectSystem, TeleportAimGate, ThrowVelocityTracker, TransformSyncSystem, UIInteractionSystem, UIPanelSystem, VELOCITY_SAMPLES, VRTeleportAreaSystem, VideoSystem, XRAnchorSystem, XRControllerVisualSystem, XREnvironmentSystem, XRHandPoseSystem, XRHitTestSystem, XRHoverVisualSystem, XRInputSystem, XRInteractionSystem, XRLocomotionSystem, XRSessionSystem, XRTeleportVisualSystem, XR_FINGERS, XR_HOVER_SHELL_FLAG, angularVelocityFrom, applyHandMaterial, arcGroundCrossing, buildComponentValueMaps, buildNodeKeyMapsFromSnapshot, buildNodeMapsFromSnapshot, canonicalizeComponentValue, clearPrefabCache, collectDiffPaths, collectEntitySubtree, collectSnapshotSubtreeIds, computeFingerCurl, computeHandShape, computeInstanceOverrides, computePalmPose, computePalmWidth, computePinch, computeSpread, createHandMaterial, decanonicalizeComponentValue, despawnPrefab, encodeOverride, estimateHandScale, findSnapshotRootEntityIds, findTopLevelNestedRegions, groupOverridePaths, hydrateWorldFromSnapshot, hydrateWorldFromSnapshotDetailed, indexSnapshotByEntity, instantiateSubtree, loadPrefab, matchHandPose, mergeComponentValue, parseOverride, parsePrefabAsset, prefabFileVersionFor, readXrCapabilities, restoreComponentState, restorePostCreateComponents, sampleTeleportArc, setPrefabAssetUrlResolver, spawnPrefab } from './chunk-DF5SSRN6.js';
3
3
  import { registerDefaultFactories } from './chunk-RXBLOO5B.js';
4
4
  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, createUIButtonComponent, createUIPanelComponent, createUISliderComponent, createUITextComponent, createUIToggleComponent, createVRTeleportAreaComponent, createVideoComponent, createXRAnchorComponent, createXRHandPoseComponent, createXRInteractableComponent, createXRInteractorComponent, createXRInteractorSideComponent, createXRRigComponent, registerDefaultComponentFactories, registerDefaultFactories } from './chunk-RXBLOO5B.js';
5
5
  import { ObjectManagementSystem } from './chunk-WJD2VKEH.js';
@@ -6403,7 +6403,12 @@ var HYDRATABLE_ENTITY_KINDS = /* @__PURE__ */ new Set([
6403
6403
  "scriptObject",
6404
6404
  "xrRig",
6405
6405
  "xrInteractor",
6406
- "teleportArea"
6406
+ "teleportArea",
6407
+ "uiPanel",
6408
+ "uiText",
6409
+ "uiButton",
6410
+ "uiToggle",
6411
+ "uiSlider"
6407
6412
  ]);
6408
6413
 
6409
6414
  // core/hydration/hydrateWorld.ts
@@ -10103,6 +10108,11 @@ function debugColorFor(kind, semanticLabel) {
10103
10108
  }
10104
10109
  __name(debugColorFor, "debugColorFor");
10105
10110
  var GLOBAL_MESH_DEBUG_OPACITY = 0.35;
10111
+ var GLOBAL_MESH_SWITCH_MARGIN = 1.5;
10112
+ function isGlobalMeshSurface(mesh) {
10113
+ return (mesh.semanticLabel ?? null) === "global mesh";
10114
+ }
10115
+ __name(isGlobalMeshSurface, "isGlobalMeshSurface");
10106
10116
  var DEBUG_RENDER_ORDER = 900;
10107
10117
  var ROOM_CAPTURE_DELAY_SECONDS = 3;
10108
10118
  var SYNTHETIC_FLOOR_EXTENT = 50;
@@ -10141,6 +10151,10 @@ var _XREnvironmentSystem = class _XREnvironmentSystem {
10141
10151
  this.roomCaptureRequested = false;
10142
10152
  /** This frame's inverse viewer matrix, or null when unavailable. */
10143
10153
  this.viewerInverse = null;
10154
+ /** This frame's viewer position in reference space, for room election. */
10155
+ this.viewerPos = null;
10156
+ /** The ONE global room mesh currently allowed to spawn. */
10157
+ this.electedGlobalMesh = null;
10144
10158
  this.tmpViewerMatrix = new THREE26__namespace.Matrix4();
10145
10159
  this.tmpViewPos = new THREE26__namespace.Vector3();
10146
10160
  }
@@ -10181,7 +10195,14 @@ var _XREnvironmentSystem = class _XREnvironmentSystem {
10181
10195
  const useMesh = (mode === "mesh" || mode === "auto") && meshesAvailable;
10182
10196
  const usePlanes = mode === "planes" || mode === "auto" && !useMesh;
10183
10197
  const viewer = frame.getViewerPose?.(referenceSpace);
10184
- this.viewerInverse = viewer ? this.tmpViewerMatrix.fromArray(viewer.transform.matrix).invert() : null;
10198
+ if (viewer) {
10199
+ const vm = viewer.transform.matrix;
10200
+ this.viewerPos = { x: vm[12], y: vm[13], z: vm[14] };
10201
+ this.viewerInverse = this.tmpViewerMatrix.fromArray(vm).invert();
10202
+ } else {
10203
+ this.viewerPos = null;
10204
+ this.viewerInverse = null;
10205
+ }
10185
10206
  if (usePlanes) {
10186
10207
  this.syncPlanes(world, frame, referenceSpace, deltaTime);
10187
10208
  } else if (this.planes.size > 0) {
@@ -10336,7 +10357,17 @@ var _XREnvironmentSystem = class _XREnvironmentSystem {
10336
10357
  for (const mesh of this.pendingMeshes.keys()) {
10337
10358
  if (!detected.has(mesh)) this.pendingMeshes.delete(mesh);
10338
10359
  }
10360
+ const electedGlobal = this.electGlobalMesh(frame, detected, referenceSpace);
10339
10361
  for (const mesh of detected) {
10362
+ if (isGlobalMeshSurface(mesh) && mesh !== electedGlobal) {
10363
+ const stale = this.meshes.get(mesh);
10364
+ if (stale) {
10365
+ this.destroyEntry(world, stale);
10366
+ this.meshes.delete(mesh);
10367
+ }
10368
+ this.pendingMeshes.delete(mesh);
10369
+ continue;
10370
+ }
10340
10371
  const pose = frame.getPose(mesh.meshSpace, referenceSpace);
10341
10372
  if (!pose) continue;
10342
10373
  const emulated = pose.emulatedPosition === true;
@@ -10360,6 +10391,45 @@ var _XREnvironmentSystem = class _XREnvironmentSystem {
10360
10391
  if (allowed) this.applyPose(world, entry.entityId, pose);
10361
10392
  }
10362
10393
  }
10394
+ /**
10395
+ * Pick THE room's global mesh: the one whose scan origin is nearest the
10396
+ * viewer, sticky to the current choice within a margin so origin jitter
10397
+ * can't flap the room. Without a viewer pose (or with a single candidate)
10398
+ * the first candidate stands; ties are impossible to break anyway.
10399
+ */
10400
+ electGlobalMesh(frame, detected, referenceSpace) {
10401
+ let nearest = null;
10402
+ let nearestDist = Number.POSITIVE_INFINITY;
10403
+ let currentDist = Number.POSITIVE_INFINITY;
10404
+ let currentStillDetected = false;
10405
+ for (const mesh of detected) {
10406
+ if (!isGlobalMeshSurface(mesh)) continue;
10407
+ if (!this.viewerPos) {
10408
+ return this.electedGlobalMesh && detected.has(this.electedGlobalMesh) ? this.electedGlobalMesh : mesh;
10409
+ }
10410
+ const pose = frame.getPose(mesh.meshSpace, referenceSpace);
10411
+ if (!pose) continue;
10412
+ const m = pose.transform.matrix;
10413
+ const d = Math.hypot(
10414
+ m[12] - this.viewerPos.x,
10415
+ m[13] - this.viewerPos.y,
10416
+ m[14] - this.viewerPos.z
10417
+ );
10418
+ if (mesh === this.electedGlobalMesh) {
10419
+ currentDist = d;
10420
+ currentStillDetected = true;
10421
+ }
10422
+ if (d < nearestDist) {
10423
+ nearestDist = d;
10424
+ nearest = mesh;
10425
+ }
10426
+ }
10427
+ if (currentStillDetected && currentDist < nearestDist + GLOBAL_MESH_SWITCH_MARGIN) {
10428
+ return this.electedGlobalMesh;
10429
+ }
10430
+ this.electedGlobalMesh = nearest;
10431
+ return nearest;
10432
+ }
10363
10433
  /**
10364
10434
  * Admission control for a NOT-yet-spawned surface. With a viewer pose
10365
10435
  * available, the surface must behave world-anchored for a few frames before
@@ -10571,6 +10641,7 @@ var _XREnvironmentSystem = class _XREnvironmentSystem {
10571
10641
  this.clearMap(world, this.meshes);
10572
10642
  this.pendingPlanes.clear();
10573
10643
  this.pendingMeshes.clear();
10644
+ this.electedGlobalMesh = null;
10574
10645
  }
10575
10646
  dispose(world) {
10576
10647
  this.clearAll(world);