From 46a28b9db6ba195e81bf5f9c3599d20a36202717 Mon Sep 17 00:00:00 2001 From: jlacoche <jeremy.lacoche@orange.com> Date: Tue, 30 Jul 2024 21:39:55 +0200 Subject: [PATCH] fix build on iOS (caused by geospatial), arkit map now only track if anchor is tracked (update readme accordingly) --- README.md | 2 +- Runtime/Scripts/WorldAnalysisARFoundation.cs | 4 ++-- .../Scripts/WorldAnalysisARFoundationModuleARKitWorldMap.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 24c4251..237c53b 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ https://developer.apple.com/documentation/arkit/arworldmap The .map file can be placed in the Unity persistent data path of the application on the user device with the following name: "ARkitWorlMap.map". Alternatively, the variable keyvalueTags of the Trackable can also contain a parameter with the "url" key providing a link to download the map file. -By default, the origin of the Map Trackable is the point (0, 0 ,0). If the Map includes an Anchor, you can use it as the origin by setting the name of the Trackable in the World Storage with the TrackableId of the ARAnchor stored in the map. https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@5.1/api/UnityEngine.XR.ARSubsystems.TrackableId.html +The map needs to include at least one Anchor. You can use one of them as the origin of the map by setting the name of the Trackable in the World Storage with the TrackableId of the ARAnchor stored in the map. https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@5.1/api/UnityEngine.XR.ARSubsystems.TrackableId.html Samples for creating and serializing an ARWorldMap with ARFoundation can be found here: https://github.com/Unity-Technologies/arfoundation-samples/blob/main/Assets/Scripts/Runtime/ARWorldMapController.cs diff --git a/Runtime/Scripts/WorldAnalysisARFoundation.cs b/Runtime/Scripts/WorldAnalysisARFoundation.cs index 34925a2..97f94a9 100644 --- a/Runtime/Scripts/WorldAnalysisARFoundation.cs +++ b/Runtime/Scripts/WorldAnalysisARFoundation.cs @@ -84,8 +84,6 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface WorldAnalysisARFoundationModuleImage imageModule = new WorldAnalysisARFoundationModuleImage(); m_trackableModules.Add(imageModule); - WorldAnalysisARFoundationModuleGeospatial geospatialModule = new WorldAnalysisARFoundationModuleGeospatial(); - m_trackableModules.Add(geospatialModule); #if UNITY_IOS WorldAnalysisARFoundationModuleMesh meshModule = new WorldAnalysisARFoundationModuleMesh(); m_trackableModules.Add(meshModule); @@ -98,6 +96,8 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface // todo add script define symbol for using arcore extensions WorldAnalysisARFoundationModuleARCoreAnchor arCoreAnchorModule = new WorldAnalysisARFoundationModuleARCoreAnchor(); m_trackableModules.Add(arCoreAnchorModule); + WorldAnalysisARFoundationModuleGeospatial geospatialModule = new WorldAnalysisARFoundationModuleGeospatial(); + m_trackableModules.Add(geospatialModule); #else /// on other os : if arcore extensions is in the scene we disable it Google.XR.ARCoreExtensions.ARCoreExtensions arCoreExtensions = Component.FindObjectOfType<Google.XR.ARCoreExtensions.ARCoreExtensions>(); diff --git a/Runtime/Scripts/WorldAnalysisARFoundationModuleARKitWorldMap.cs b/Runtime/Scripts/WorldAnalysisARFoundationModuleARKitWorldMap.cs index 5b1ef20..7019f3a 100644 --- a/Runtime/Scripts/WorldAnalysisARFoundationModuleARKitWorldMap.cs +++ b/Runtime/Scripts/WorldAnalysisARFoundationModuleARKitWorldMap.cs @@ -231,7 +231,7 @@ public class WorldAnalysisARFoundationModuleARKitWorldMap : WorldAnalysisARFound data.Dispose(); } sessionSubsystem.ApplyWorldMap(worldMap); - UpdateTrackableInfoWithPose(Vector3.zero, Quaternion.identity); // before trying to find an anchor: default pause is origin of the map + //UpdateTrackableInfoWithPose(Vector3.zero, Quaternion.identity); // before trying to find an anchor: default pause is origin of the map } } } -- GitLab