@relu-interactives/spatial-ecs 0.4.1 → 0.4.3

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.
@@ -7980,6 +7980,14 @@ var _XREnvironmentSystem = class _XREnvironmentSystem {
7980
7980
  } else if (changed !== entry.lastChangedTime) {
7981
7981
  entry.lastChangedTime = changed;
7982
7982
  this.applyPlaneCollider(world, entry.entityId, plane);
7983
+ if (this.debugVisible) {
7984
+ const collider = planeColliderFromPolygon(plane.polygon);
7985
+ if (collider) {
7986
+ entry.geometry?.dispose();
7987
+ entry.geometry = null;
7988
+ this.attachPlaneDebug(world, entry, collider);
7989
+ }
7990
+ }
7983
7991
  }
7984
7992
  this.applyPose(world, entry.entityId, pose);
7985
7993
  }
@@ -8091,10 +8099,18 @@ var _XREnvironmentSystem = class _XREnvironmentSystem {
8091
8099
  wireframe: true
8092
8100
  });
8093
8101
  const root = new THREE19.Group();
8094
- root.add(new THREE19.Mesh(geometry, material));
8102
+ const child = new THREE19.Mesh(geometry, material);
8103
+ child.position.set(collider.offset.x, collider.offset.y, collider.offset.z);
8104
+ child.visible = this.debugVisible;
8105
+ root.add(child);
8095
8106
  entry.geometry = geometry;
8096
8107
  entry.material = material;
8097
- world.addComponent(entry.entityId, new Object3DRef(root));
8108
+ const existing = world.getComponent(entry.entityId, Object3DRef);
8109
+ if (existing) {
8110
+ existing.object = root;
8111
+ } else {
8112
+ world.addComponent(entry.entityId, new Object3DRef(root));
8113
+ }
8098
8114
  }
8099
8115
  applyPose(world, entityId, pose) {
8100
8116
  const transform = world.getComponent(entityId, TransformComponent);
@@ -8102,6 +8118,13 @@ var _XREnvironmentSystem = class _XREnvironmentSystem {
8102
8118
  decomposeXrPose(pose.transform.matrix, transform);
8103
8119
  }
8104
8120
  applyDebugVisibility(world) {
8121
+ if (this.debugVisible) {
8122
+ for (const [plane, entry] of this.planes) {
8123
+ if (entry.geometry) continue;
8124
+ const collider = planeColliderFromPolygon(plane.polygon);
8125
+ if (collider) this.attachPlaneDebug(world, entry, collider);
8126
+ }
8127
+ }
8105
8128
  for (const map of [this.planes, this.meshes]) {
8106
8129
  for (const entry of map.values()) {
8107
8130
  const ref = world.getComponent(entry.entityId, Object3DRef);
@@ -9578,5 +9601,5 @@ __name(_XRHoverVisualSystem, "XRHoverVisualSystem");
9578
9601
  var XRHoverVisualSystem = _XRHoverVisualSystem;
9579
9602
 
9580
9603
  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, 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 };
9581
- //# sourceMappingURL=chunk-LAOFCFEI.js.map
9582
- //# sourceMappingURL=chunk-LAOFCFEI.js.map
9604
+ //# sourceMappingURL=chunk-6UZC6M7V.js.map
9605
+ //# sourceMappingURL=chunk-6UZC6M7V.js.map