I have been working on UnityARworldMap scene.Trying to load two or more worldmaps(.worldmap extension) which I saved earlier.Starting I load one worldmap,after covering some distance I load second worldmap and the next worldmap after some distance.
I successfully loaded the first arworldmap and prefabs are coming at accurate positions in real world.The problem I faced is when I load the second worldmap the prefabs loaded on the first map changes their position (resets) and loaded at different positons.The reason I believe is that the second map does not contain any position of the prefabs in the first map.Without resetting how to load the other maps along with the first map?
public void Load(string flname)
{
//Loading file from persistent path
Debug.LogFormat("Loading ARWorldMap {0}", Loadpath);
var worldMap = ARWorldMap.Load(Loadpath);
if (worldMap != null)
{
m_LoadedMap = worldMap;
Debug.LogFormat("Map loaded. Center: {0} Extent: {1}", worldMap.center, worldMap.extent);
UnityARSessionNativeInterface.ARSessionShouldAttemptRelocalization = true;
var config = m_ARCameraManager.sessionConfiguration;
config.worldMap = worldMap;
UnityARSessionRunOption runOption = UnityARSessionRunOption.ARSessionRunOptionRemoveExistingAnchors | UnityARSessionRunOption.ARSessionRunOptionResetTracking;
Debug.Log("Restarting session with worldMap");
session.RunWithConfigAndOptions(config, runOption);
// StopPlaneDetection();
}
else
{
Debug.Log("No World Map loaded");
}
}
This is how I load maps after different intervals (given below) .
Load(path+FileName2);//for second world map
Load(path+FileName3);//for third world map