From a85fe4e24bba05fed6772d0c0179ac46fd2383b4 Mon Sep 17 00:00:00 2001 From: chenyulin Date: Wed, 3 Apr 2024 00:49:04 +0800 Subject: [PATCH 1/3] poop: change observer profeile --- .../CYL MixedRealityToolkitConfigurationProfile.asset | 2 +- ProjectSettings/ProjectSettings.asset | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Assets/MixedRealityToolkit.Generated/CustomProfiles/CYL MixedRealityToolkitConfigurationProfile.asset b/Assets/MixedRealityToolkit.Generated/CustomProfiles/CYL MixedRealityToolkitConfigurationProfile.asset index 8ca8223..476ec44 100644 --- a/Assets/MixedRealityToolkit.Generated/CustomProfiles/CYL MixedRealityToolkitConfigurationProfile.asset +++ b/Assets/MixedRealityToolkit.Generated/CustomProfiles/CYL MixedRealityToolkitConfigurationProfile.asset @@ -39,7 +39,7 @@ MonoBehaviour: spatialAwarenessSystemType: reference: Microsoft.MixedReality.Toolkit.SpatialAwareness.MixedRealitySpatialAwarenessSystem, Microsoft.MixedReality.Toolkit.Services.SpatialAwarenessSystem - spatialAwarenessSystemProfile: {fileID: 11400000, guid: 97da727944a3d7b4caf42d2273271a24, type: 2} + spatialAwarenessSystemProfile: {fileID: 11400000, guid: bacc3ee1fe0019e488dcc47839b347a6, type: 2} diagnosticsSystemProfile: {fileID: 11400000, guid: 478436bd1083882479a52d067e98e537, type: 2} enableDiagnosticsSystem: 0 diagnosticsSystemType: diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index be84f19..37e9b9c 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -140,7 +140,9 @@ PlayerSettings: 16:9: 1 Others: 1 bundleVersion: 0.1 - preloadedAssets: [] + preloadedAssets: + - {fileID: 8321957382987395078, guid: cb5bdb69939591a40a9fee59973e1aa5, type: 2} + - {fileID: -2595508646683038055, guid: 1ae829b530bde0c40883963f0c63ec6e, type: 2} metroInputSource: 0 wsaTransparentSwapchain: 0 m_HolographicPauseOnTrackingLoss: 1 From 96edf8915bae3fe0a2c61d8ed1f122a77baac887 Mon Sep 17 00:00:00 2001 From: chenyulin Date: Wed, 3 Apr 2024 00:57:51 +0800 Subject: [PATCH 2/3] feat. toggle spatial mesh display --- Assets/Script/UI/ToggleRoomMesh.cs | 17 +++++++---------- ProjectSettings/ProjectSettings.asset | 4 +--- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Assets/Script/UI/ToggleRoomMesh.cs b/Assets/Script/UI/ToggleRoomMesh.cs index 7f64ab3..eccdc06 100644 --- a/Assets/Script/UI/ToggleRoomMesh.cs +++ b/Assets/Script/UI/ToggleRoomMesh.cs @@ -6,21 +6,21 @@ public class ToggleRoomMesh : MonoBehaviour { - public IMixedRealitySpatialAwarenessSystem spatialAwarenessSystem; + public IMixedRealitySpatialAwarenessMeshObserver observer; public bool spatialMeshEnabled = false; void Start() { // 获取Spatial Awareness系统 - spatialAwarenessSystem = CoreServices.SpatialAwarenessSystem; + observer = CoreServices.GetSpatialAwarenessSystemDataProvider(); - if (spatialAwarenessSystem == null) + if (observer == null) { Debug.LogError("Spatial Awareness System is not available."); } else { - spatialAwarenessSystem.SuspendObservers(); + observer.DisplayOption = SpatialAwarenessMeshDisplayOptions.Occlusion; spatialMeshEnabled = false; } } @@ -28,19 +28,16 @@ void Start() // 当按钮被按下时调用 public void OnButtonPress() { - if (spatialAwarenessSystem != null) + if (observer != null) { if (spatialMeshEnabled) { - // 关闭环境网格的显示 - spatialAwarenessSystem.ClearObservations(); - spatialAwarenessSystem.SuspendObservers(); + observer.DisplayOption = SpatialAwarenessMeshDisplayOptions.Occlusion; spatialMeshEnabled = false; } else { - // 启用环境网格的显示 - spatialAwarenessSystem.ResumeObservers(); + observer.DisplayOption = SpatialAwarenessMeshDisplayOptions.Visible; spatialMeshEnabled = true; } } diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 37e9b9c..be84f19 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -140,9 +140,7 @@ PlayerSettings: 16:9: 1 Others: 1 bundleVersion: 0.1 - preloadedAssets: - - {fileID: 8321957382987395078, guid: cb5bdb69939591a40a9fee59973e1aa5, type: 2} - - {fileID: -2595508646683038055, guid: 1ae829b530bde0c40883963f0c63ec6e, type: 2} + preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0 m_HolographicPauseOnTrackingLoss: 1 From 6bd8079af1583f9282d5a9269e0d1a6c3b5f6d4b Mon Sep 17 00:00:00 2001 From: chenyulin Date: Wed, 3 Apr 2024 00:58:14 +0800 Subject: [PATCH 3/3] feat. toggle spatial mesh display, close #1