Commit 46a28b9d authored by Jérémy Lacoche's avatar Jérémy Lacoche
Browse files

fix build on iOS (caused by geospatial), arkit map now only track if anchor is...

fix build on iOS (caused by geospatial), arkit map now only track if anchor is tracked (update readme accordingly)
parent c3d24c72
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 
+2 −2
Original line number Diff line number Diff line
@@ -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>();
+1 −1
Original line number Diff line number Diff line
@@ -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
        }
    }
}