Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • arf/world-analysis-api-helpers/unity-world-analysis-arfoundation-wrapper-package
1 result
Show changes
Commits on Source (3)
......@@ -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
......
......@@ -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>();
......
......@@ -64,7 +64,7 @@ public class WorldAnalysisARFoundationModuleARCoreAnchor : WorldAnalysisARFounda
/// <returns>map or not (does not check is solved)</returns>
public bool AddTrackable(ETSI.ARF.OpenAPI.WorldStorage.Trackable trackable)
{
/// Here : we don't check if the trackable is allready added, AddImageToLibrary does it
/// Here : we don't check if the trackable is allready added
if (trackable.TrackableType != ETSI.ARF.OpenAPI.WorldStorage.TrackableType.MAP)
{
return false;
......@@ -102,7 +102,6 @@ public class WorldAnalysisARFoundationModuleARCoreAnchor : WorldAnalysisARFounda
Vector3 position = trackedCloudAnchor.transform.position;
Quaternion rotation = trackedCloudAnchor.transform.rotation;
TrackableInfo info = new TrackableInfo();
info.name = trackedCloudAnchor.name;
string localId = trackedCloudAnchor.trackableId.subId1.ToString("X16");// there must be a better way : does it work every time?
......@@ -182,13 +181,8 @@ public class WorldAnalysisARFoundationModuleARCoreAnchor : WorldAnalysisARFounda
var result = promise.Result;
if (result.CloudAnchorState == CloudAnchorState.Success)
{
Debug.Log("ARCloud Anchor Resolve Sucess" +cloudId);
m_localIdToEtsiId.Add(result.Anchor.trackableId.subId2.ToString("X16"), etsiId); // should be a better way: not sure about that but subId2 of the ARCloudAnchor seems to correspond to subId1 of local anchor that is updated by Anchor Manager
}
else
{
Debug.Log("ARCloud Anchor Resolve Failed" + result.CloudAnchorState + " " +cloudId);
}
}
}
......
......@@ -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
}
}
}
......
fileFormatVersion: 2
guid: 2230c312c9cd04c488d9d8a3e058f39b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: