public void Load(string fileName) { var worldMap = ARWorldMap.Load(Path.Combine(Application.persistentDataPath, string.Concat(fileName, ".worldmap"))); if (worldMap != null) { windowManager.SpawnGuideToLoad(); loadedWorldMapName = fileName; UnityARSessionNativeInterface.ARSessionShouldAttemptRelocalization = true; relocalizing = true; startTime = Time.time; ARKitWorldTrackingSessionConfiguration config = m_ARCameraManager.sessionConfiguration; config.worldMap = worldMap; UnityARSessionRunOption runOption = UnityARSessionRunOption.ARSessionRunOptionRemoveExistingAnchors | UnityARSessionRunOption.ARSessionRunOptionResetTracking; foreach (GameObject go in GameObject.FindGameObjectsWithTag("Line")) { Destroy(go); } session.RunWithConfigAndOptions(config, runOption); } }
public void Load() { if (path != null) { Debug.LogFormat("Loading ARWorldMap {0}", path); var worldMap = ARWorldMap.Load(path); 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; //m_TGOPlacement.Reset(); //m_ESAPlacement.Reset(); Debug.Log("Restarting session with worldMap"); session.RunWithConfigAndOptions(config, runOption); } } else { Debug.Log("Please, specify a path"); } }
void LoadWorldMap() { Debug.Log("Attempting to load ARWorldMap."); //GlobalMapManager.Instance.DownloadLatestMap(() => //{ // var worldMap = ARWorldMap.Load(GlobalMapManager.Instance.WorldMapPath); // if (worldMap != null) // { // Debug.LogFormat("Map loaded. Center: {0} Extent: {1}", worldMap.center, worldMap.extent); // var config = ARKitManager.Instance.DefaultSessionConfiguration; // config.worldMap = worldMap; // UnityARSessionRunOption runOption = UnityARSessionRunOption.ARSessionRunOptionRemoveExistingAnchors | UnityARSessionRunOption.ARSessionRunOptionResetTracking; // Debug.Log("Restarting session with worldMap"); // ARKitManager.Instance.Session.RunWithConfigAndOptions(config, runOption); // } //}); var worldMap = ARWorldMap.Load(GlobalMapManager.Instance.WorldMapPath); if (worldMap != null) { Debug.LogFormat("Map loaded. Center: {0} Extent: {1}", worldMap.center, worldMap.extent); var config = ARKitManager.Instance.DefaultSessionConfiguration; config.worldMap = worldMap; UnityARSessionRunOption runOption = UnityARSessionRunOption.ARSessionRunOptionRemoveExistingAnchors | UnityARSessionRunOption.ARSessionRunOptionResetTracking; Debug.Log("Restarting session with worldMap"); ARKitManager.Instance.Session.RunWithConfigAndOptions(config, runOption); } }
public void Load(string name, string filePath) { Debug.LogFormat("Loading ARWorldMap {0}", filePath); var worldMap = ARWorldMap.Load(filePath); if (worldMap != null) { GroundPlaneManager.instance.NewSession(true); 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); loadingname = name; isLoading = true; } }
public UniTask Load(string dirPath) { string path = GetPath(dirPath); ARWorldMap worldMap = ARWorldMap.Load(path); Debug.Log($"ARWorldMap loaded from {path}"); ARKitWorldTrackingSessionConfiguration config = _camera.sessionConfiguration; config.worldMap = worldMap; const UnityARSessionRunOption runOption = UnityARSessionRunOption.ARSessionRunOptionRemoveExistingAnchors | UnityARSessionRunOption.ARSessionRunOptionResetTracking; UnityARSessionNativeInterface .ARSessionShouldAttemptRelocalization = true; UnityARSessionNativeInterface .GetARSessionNativeInterface() .RunWithConfigAndOptions(config, runOption); Debug.Log("Restarted session with worldMap"); return(UniTask.CompletedTask); }
private void OnLoadClick() { UnityARSessionNativeInterface.ARSessionShouldAttemptRelocalization = true;//重定位 ARWorldMap newWorldMap = ARWorldMap.Load(Config.path); ARKitWorldTrackingSessionConfiguration configration = m_ARCameraManager.sessionConfiguration; configration.worldMap = newWorldMap; UnityARSessionRunOption option = UnityARSessionRunOption.ARSessionRunOptionRemoveExistingAnchors | UnityARSessionRunOption.ARSessionRunOptionResetTracking; Config.m_Swssion.RunWithConfigAndOptions(configration, option); }
void LoadWorldMap() { Debug.LogFormat("Loading ARWorldMap {0}", WorldMapPath); var worldMap = ARWorldMap.Load(WorldMapPath); if (worldMap != null) { Debug.LogFormat("Map loaded. Center: {0} Extent: {1}", worldMap.center, worldMap.extent); var config = ARKitCameraManager.Instance.sessionConfiguration; config.worldMap = worldMap; UnityARSessionRunOption runOption = UnityARSessionRunOption.ARSessionRunOptionRemoveExistingAnchors | UnityARSessionRunOption.ARSessionRunOptionResetTracking; Debug.Log("Restarting session with worldMap"); Session.RunWithConfigAndOptions(config, runOption); referenceImage.GetComponent <Image>().sprite = UtilitiesCR.LoadNewSprite(ReferenceImagePath); referenceImage.SetActive(true); } }
/// <summary> /// 加载ARWorldMap /// </summary> public void Load() { Debug.LogFormat("Loading ARWorldMap {0}", Path); #if !UNITY_EDITOR var worldMap = ARWorldMap.Load(Path); 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); } #endif StartCoroutine(SceneRecogOver()); }
public void Load() { Debug.LogFormat("Loading ARWorldMap {0}", path); var worldMap = ARWorldMap.Load(path); 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); myCube.transform.position = new Vector3(PlayerPrefs.GetFloat("PlayerX"), PlayerPrefs.GetFloat("PlayerY"), PlayerPrefs.GetFloat("PlayerZ")); } }