diff --git a/com.htc.upm.vive.openxr/Runtime/Features/SecondaryViewConfiguration/Scripts/SpectatorCameraBased.cs b/com.htc.upm.vive.openxr/Runtime/Features/SecondaryViewConfiguration/Scripts/SpectatorCameraBased.cs index addcd25..8bb2927 100644 --- a/com.htc.upm.vive.openxr/Runtime/Features/SecondaryViewConfiguration/Scripts/SpectatorCameraBased.cs +++ b/com.htc.upm.vive.openxr/Runtime/Features/SecondaryViewConfiguration/Scripts/SpectatorCameraBased.cs @@ -583,6 +583,11 @@ private void Start() SpectatorCamera = SpectatorCameraGameObject.AddComponent(); SpectatorCamera.stereoTargetEye = StereoTargetEyeMask.None; + + // Match spectator camera to camera settings (enable passthrough) + SpectatorCamera.clearFlags = Camera.main ? Camera.main.clearFlags : CameraClearFlags.SolidColor; + SpectatorCamera.backgroundColor = Camera.main ? Camera.main.backgroundColor : Color.black; + MainCamera = GetMainCamera(); if (MainCamera != null) { @@ -833,4 +838,4 @@ private void OnSceneLoaded(Scene scene, LoadSceneMode mode) #endregion } -} \ No newline at end of file +} diff --git a/com.htc.upm.vive.openxr/Runtime/Toolkits/Anchor/AnchorManager.cs b/com.htc.upm.vive.openxr/Runtime/Toolkits/Anchor/AnchorManager.cs index ff76656..8183935 100644 --- a/com.htc.upm.vive.openxr/Runtime/Toolkits/Anchor/AnchorManager.cs +++ b/com.htc.upm.vive.openxr/Runtime/Toolkits/Anchor/AnchorManager.cs @@ -282,11 +282,17 @@ public static void ReleasePersistedAnchorCollection() }); } - private static XrResult CompletePA(IntPtr future) { + // Updated CompletePA to set isPersisted = true on success + private static XrResult CompletePA(IntPtr future, Anchor anchor) { Debug.Log("AnchorManager: CompletePA"); var ret = feature.PersistSpatialAnchorComplete(future, out var completion); if (ret == XrResult.XR_SUCCESS) { + if (anchor != null && completion.futureResult == XrResult.XR_SUCCESS) + { + anchor.isPersisted = true; + anchor.isTrackable = true; // Persisted anchors are also trackable + } return completion.futureResult; } else @@ -319,7 +325,8 @@ public static FutureTask PersistAnchor(Anchor anchor, string persistan { // If no auto complete, you can cancel the task and no need to free resouce. // Once it completed, you need handle the result. - return new FutureTask(future, CompletePA, 10, autoComplete: false); + // Pass anchor to CompletePA so it can update isPersisted/isTrackable + return new FutureTask(future, (fut) => CompletePA(fut, anchor), 10, autoComplete: false); } return FutureTask.FromResult(ret); @@ -410,6 +417,7 @@ public static XrResult EnumeratePersistedAnchorNames(out string[] names) return ret; } + // Updated CompleteCreateSAfromPA to set isTrackable = true private static (XrResult, Anchor) CompleteCreateSAfromPA(IntPtr future) { Debug.Log("AnchorManager: CompleteCreateSAfromPA"); @@ -418,6 +426,7 @@ private static (XrResult, Anchor) CompleteCreateSAfromPA(IntPtr future) { var anchor = new Anchor(completion.anchor); anchor.isTrackable = true; + // If created from a persisted anchor, it is not necessarily persisted yet, so isPersisted remains false return (completion.futureResult, anchor); } else