diff --git a/README.md b/README.md index dc9d00b0693e97d378e81ff38b44f01913d3ade6..ddda2ae97510a1b62c7c170685a02ca22eed5cc5 100644 --- a/README.md +++ b/README.md @@ -24,4 +24,82 @@ This wrapper for the World Analysis relies on the ARFoundation (version 5.1.x) U Image markers are supported on both iOS and Android platforms through ARKit and ARCore. -The name of the Trackable in the World Storage must correspond to the name of a file (jpg or png) placed in the Unity persistent data path of the application on the user device. \ No newline at end of file +The name of the Trackable in the World Storage must correspond to the name of a file (jpg or png) placed in the Unity persistent data path of the application on the user device. The variable keyvalueTags of the Trackable can also contain a parameter with the "url" key providing a link to download the image. + +More information about ARFoundation Image Tracking can be found here: https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@5.1/manual/index.html + +### Mesh Trackables ### + +Mesh trackables are supported on iOS through ARKit. + +ARKit can track meshes that are defined in the .arobject format. Such an object can be scanned with the sample application provided here: https://developer.apple.com/documentation/arkit/arkit_in_ios/content_anchors/scanning_and_detecting_3d_objects + +Unity serializes .arobject into ARKitReferenceObjectEntry in the editor. ARKitReferenceObjectEntry cannot then be imported at runtime from a .arobjject file. Dynamic loading is not supported yet. + +To support adding .arobject without recompiling the full application, we use a dedicated AssetBundle. +* Place you .arobject in the Assets Folder. For instance under Assets/ARObjects +* Associate the ARKitReferenceObjectEntry with the arfmeshes AssetBundle in the editor +* Build the AssetBundles. For that you can use the following menu: ARF--> Build AssetBundles iOS + +Then you have two options: +* Placing the AssetBundle "arfmeshes" file (with this exact file name) in the Unity persistent data path of the application on the user device. +* The variable keyvalueTags of the Trackable can also contain a parameter with the "url" key providing a link to download the AssetBundle to the Unity persistent data path on the user device. Only one AssetBundle can be loaded. + +The name of the Trackable in the World Storage must correspond to the name of the ARKitReferenceObjectEntry. + +More information about ARFoundation Mesh Tracking can be found here: https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@5.1/manual/features/object-tracking.html + +### Map Trackables ### + +#### iOS: ARWorldMap #### + +On iOS/ARKit Map Trackables are supported with ARWorlMap feature. Only one Map Trackable per World Graph is supported. + +In ARKit, an ARWorldMap includes ARKit's awareness of the physical space in which the user moves the device that can be serialized into a file to be reloaded later on the same or on another device: +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. + +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 + +#### Android ARCore Cloud Anchors #### + +On Android/ARCore Map Trackables are supported with Google Cloud Anchors. + +Cloud Anchors are anchors that are hosted on the ARCore API cloud endpoint. This hosting enables users to share experiences in the same app: see https://developers.google.com/ar/develop/cloud-anchors + +For using ARCore cloud anchors you need to: +* Add the the arcore unity extensions package as a dependency of the Unity project https://github.com/google-ar/arcore-unity-extensions +* Add to the runtime asmdef of this package a reference to Google.XR.ARCoreExtensions.asmdef +* Add a new Script Define Symbol in the Unity project settings: "ETSIARF_ARCORE_EXTENSIONS" +* Then, follow the instructions detailed here https://developers.google.com/ar/develop/unity-arf/cloud-anchors/developer-guide and here https://developers.google.com/ar/develop/authorization?platform=unity-arf to configure the project and your google cloud account + +To use a Map Trackable that corresponds to a Google Cloud Anchor, the name of the Trackable in the World Storage must correspond to the name of Google UUID of the anchor. + +### Geo Trackables ### + +#### iOS: perspectives #### + +On iOS, Geo Trackables are not yet supported with this package. + +A first possibility for adding this support is to adapt the Google GeoSpatial code and then run your iOS application with the ARCore AR backend. + +A second possibility is to add the support for ARKit GeoTracking: https://developer.apple.com/documentation/arkit/arkit_in_ios/content_anchors/tracking_geographic_locations_in_ar +This feature is not implemented yet due to the small number of places supported (see https://developer.apple.com/documentation/arkit/argeotrackingconfiguration) + +#### Android: Google GeoSpatial #### + +On Android/ARCore Geo Trackables are supported with Google Geospatial Anchors. + +Geospatial Anchors are anchors that are hosted on the ARCore API cloud endpoint. This hosting enables users to share experiences in the same app using GPS and Google Earth data: see https://developers.google.com/ar/develop/geospatial + +For using ARCore Geospatial Anchors you need to: +* Add the the arcore unity extensions package as a dependency of the Unity project https://github.com/google-ar/arcore-unity-extensions +* Add to the runtime asmdef of this package a reference to Google.XR.ARCoreExtensions.asmdef +* Add a new Script Define Symbol in the Unity project settings: "ETSIARF_ARCORE_EXTENSIONS" +* Then, follow the instructions detailed here https://developers.google.com/ar/develop/unity-arf/geospatial/enable-android and here https://developers.google.com/ar/develop/authorization?platform=unity-arf to configure the project and your google cloud account + +To use a Geo Pose Trackable that corresponds to a Google Geospatial Anchor, the payload of the Trackable in the World Storage must be an array of doubles following this format : [latitude, longitude, altitude, rotationX, rotationY, rotationZ] in base 64. diff --git a/Runtime/ARCoreExtensionsConfig.asset b/Runtime/ARCoreExtensionsConfig.asset new file mode 100644 index 0000000000000000000000000000000000000000..6b08173922628b83af555d44cd7de893317ad9e2 --- /dev/null +++ b/Runtime/ARCoreExtensionsConfig.asset @@ -0,0 +1,18 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4ae147bac9ff8453284f59548528c2aa, type: 3} + m_Name: ARCoreExtensionsConfig + m_EditorClassIdentifier: + CloudAnchorMode: 1 + SemanticMode: 0 + GeospatialMode: 2 + StreetscapeGeometryMode: 0 diff --git a/Runtime/ARCoreExtensionsConfig.asset.meta b/Runtime/ARCoreExtensionsConfig.asset.meta new file mode 100644 index 0000000000000000000000000000000000000000..69fdd4044d5158662769fef5b46d80037ea95cc1 --- /dev/null +++ b/Runtime/ARCoreExtensionsConfig.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cf9adc83079e8e1479b1a105856aab0e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Materials.meta b/Runtime/Materials.meta new file mode 100644 index 0000000000000000000000000000000000000000..a60af2ed4fcdd93630733a81148c6a6fe2937d3f --- /dev/null +++ b/Runtime/Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 573d01463f1ad468bafd74041040eeb1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Materials/Blue.mat b/Runtime/Materials/Blue.mat new file mode 100644 index 0000000000000000000000000000000000000000..2adba28e66c05344aabaf1619867696c3eaff2dc --- /dev/null +++ b/Runtime/Materials/Blue.mat @@ -0,0 +1,83 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Blue + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0, g: 0, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] diff --git a/Runtime/Materials/Blue.mat.meta b/Runtime/Materials/Blue.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..97d300928fb27f31d7e4067dca83b7ed96d0da7f --- /dev/null +++ b/Runtime/Materials/Blue.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9fd9c0bd2f4f1438888297d0668f871b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Materials/Green.mat b/Runtime/Materials/Green.mat new file mode 100644 index 0000000000000000000000000000000000000000..90370803fac0862cc40276fcf9e2c848246306c9 --- /dev/null +++ b/Runtime/Materials/Green.mat @@ -0,0 +1,83 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Green + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0, g: 1, b: 0, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] diff --git a/Runtime/Materials/Green.mat.meta b/Runtime/Materials/Green.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..761238254095a9327704f572be25fa5907611aac --- /dev/null +++ b/Runtime/Materials/Green.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: de76e3ad692ba4492aaca3dd54e65f04 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Materials/Red.mat b/Runtime/Materials/Red.mat new file mode 100644 index 0000000000000000000000000000000000000000..18e55761dea05695f673b870d8f56759064cd288 --- /dev/null +++ b/Runtime/Materials/Red.mat @@ -0,0 +1,83 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Red + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 0, b: 0, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] diff --git a/Runtime/Materials/Red.mat.meta b/Runtime/Materials/Red.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..166e41da0cdb06fe43159e01392781b80a7f1b2e --- /dev/null +++ b/Runtime/Materials/Red.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9d815ae4d5a7b46ae99e4e5ed084d3a8 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Resources.meta b/Runtime/Resources.meta new file mode 100644 index 0000000000000000000000000000000000000000..b3b6637e32834bb0eecb353ea7f452024a61c686 --- /dev/null +++ b/Runtime/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: edac3a3bd280a43d885c4cbb4296dc8d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Resources/ARFAnchorTrackingPrefab.prefab b/Runtime/Resources/ARFAnchorTrackingPrefab.prefab new file mode 100644 index 0000000000000000000000000000000000000000..e50e5ac9686854e11387355ba2d3bbdadc67f699 --- /dev/null +++ b/Runtime/Resources/ARFAnchorTrackingPrefab.prefab @@ -0,0 +1,541 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &919512057412407595 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5663275178603938767} + - component: {fileID: 2250489381470411502} + - component: {fileID: 5243785181569724411} + - component: {fileID: 4959683567476516339} + m_Layer: 0 + m_Name: PurpleSphere + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &5663275178603938767 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 919512057412407595} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 20, y: 20, z: 20} + m_ConstrainProportionsScale: 1 + m_Children: [] + m_Father: {fileID: 6911754431728604849} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &2250489381470411502 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 919512057412407595} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &5243785181569724411 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 919512057412407595} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a64202207c2bc6042a40ad749c6eabf1, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!135 &4959683567476516339 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 919512057412407595} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} +--- !u!1 &6911754431728604848 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6911754431728604849} + m_Layer: 0 + m_Name: ARFAnchorTrackingPrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6911754431728604849 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754431728604848} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 6911754432812775763} + - {fileID: 6911754433267149346} + - {fileID: 6911754433204531549} + - {fileID: 5348077246929615354} + - {fileID: 5663275178603938767} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &6911754432812775762 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6911754432812775763} + - component: {fileID: 6911754432812775758} + - component: {fileID: 6911754432812775757} + - component: {fileID: 6911754432812775756} + m_Layer: 0 + m_Name: Z + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6911754432812775763 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754432812775762} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.0701} + m_LocalScale: {x: 0.01, y: 0.01, z: 0.11557999} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6911754431728604849} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &6911754432812775758 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754432812775762} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &6911754432812775757 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754432812775762} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 9fd9c0bd2f4f1438888297d0668f871b, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &6911754432812775756 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754432812775762} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!1 &6911754433204531548 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6911754433204531549} + - component: {fileID: 6911754433204531544} + - component: {fileID: 6911754433204531551} + - component: {fileID: 6911754433204531550} + m_Layer: 0 + m_Name: Y + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6911754433204531549 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433204531548} + serializedVersion: 2 + m_LocalRotation: {x: -0.5, y: -0.5, z: -0.5, w: 0.5} + m_LocalPosition: {x: 0, y: 0.0525, z: 0.0033} + m_LocalScale: {x: 0.0100000035, y: 0.01, z: 0.11558006} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6911754431728604849} + m_LocalEulerAnglesHint: {x: -90, y: -90.00001, z: 0} +--- !u!33 &6911754433204531544 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433204531548} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &6911754433204531551 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433204531548} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: de76e3ad692ba4492aaca3dd54e65f04, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &6911754433204531550 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433204531548} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!1 &6911754433267149345 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6911754433267149346} + - component: {fileID: 6911754433267149341} + - component: {fileID: 6911754433267149340} + - component: {fileID: 6911754433267149347} + m_Layer: 0 + m_Name: X + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6911754433267149346 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433267149345} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0.0528, y: 0, z: 0.0033} + m_LocalScale: {x: 0.01, y: 0.01, z: 0.11558} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6911754431728604849} + m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0} +--- !u!33 &6911754433267149341 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433267149345} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &6911754433267149340 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433267149345} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 9d815ae4d5a7b46ae99e4e5ed084d3a8, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &6911754433267149347 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433267149345} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!1 &7290371484074973697 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5348077246929615354} + - component: {fileID: 3993039649644943769} + - component: {fileID: 5219444789236537599} + m_Layer: 0 + m_Name: Cylinder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5348077246929615354 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7290371484074973697} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.025, y: 0.025, z: 0.025} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6911754431728604849} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &3993039649644943769 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7290371484074973697} + m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &5219444789236537599 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7290371484074973697} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} diff --git a/Runtime/Resources/ARFAnchorTrackingPrefab.prefab.meta b/Runtime/Resources/ARFAnchorTrackingPrefab.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..b7050cb5a0d346c6b9324dc6b66d30473ecf728a --- /dev/null +++ b/Runtime/Resources/ARFAnchorTrackingPrefab.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e5177a22bf3f76943a9c36a96126aaf5 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Resources/ARFImageTrackingPrefab.prefab b/Runtime/Resources/ARFImageTrackingPrefab.prefab new file mode 100644 index 0000000000000000000000000000000000000000..182f3b473e688c334de9dd72f9d0270807b9b720 --- /dev/null +++ b/Runtime/Resources/ARFImageTrackingPrefab.prefab @@ -0,0 +1,435 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &760227130947233616 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5628977508733984536} + - component: {fileID: 1464890553281028111} + - component: {fileID: 6389761481980281444} + m_Layer: 0 + m_Name: Sphere + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5628977508733984536 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 760227130947233616} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.05, y: 0.05, z: 0.05} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6911754431728604849} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &1464890553281028111 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 760227130947233616} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &6389761481980281444 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 760227130947233616} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &6911754431728604848 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6911754431728604849} + m_Layer: 0 + m_Name: ARFImageTrackingPrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6911754431728604849 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754431728604848} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 6911754432812775763} + - {fileID: 6911754433267149346} + - {fileID: 6911754433204531549} + - {fileID: 5628977508733984536} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &6911754432812775762 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6911754432812775763} + - component: {fileID: 6911754432812775758} + - component: {fileID: 6911754432812775757} + - component: {fileID: 6911754432812775756} + m_Layer: 0 + m_Name: Z + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6911754432812775763 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754432812775762} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.0701} + m_LocalScale: {x: 0.01, y: 0.01, z: 0.11557999} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6911754431728604849} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &6911754432812775758 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754432812775762} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &6911754432812775757 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754432812775762} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 9fd9c0bd2f4f1438888297d0668f871b, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &6911754432812775756 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754432812775762} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!1 &6911754433204531548 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6911754433204531549} + - component: {fileID: 6911754433204531544} + - component: {fileID: 6911754433204531551} + - component: {fileID: 6911754433204531550} + m_Layer: 0 + m_Name: Y + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6911754433204531549 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433204531548} + serializedVersion: 2 + m_LocalRotation: {x: -0.5, y: -0.5, z: -0.5, w: 0.5} + m_LocalPosition: {x: 0, y: 0.0525, z: 0.0033} + m_LocalScale: {x: 0.0100000035, y: 0.01, z: 0.11558006} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6911754431728604849} + m_LocalEulerAnglesHint: {x: -90, y: -90.00001, z: 0} +--- !u!33 &6911754433204531544 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433204531548} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &6911754433204531551 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433204531548} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: de76e3ad692ba4492aaca3dd54e65f04, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &6911754433204531550 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433204531548} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!1 &6911754433267149345 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6911754433267149346} + - component: {fileID: 6911754433267149341} + - component: {fileID: 6911754433267149340} + - component: {fileID: 6911754433267149347} + m_Layer: 0 + m_Name: X + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6911754433267149346 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433267149345} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0.0528, y: 0, z: 0.0033} + m_LocalScale: {x: 0.01, y: 0.01, z: 0.11558} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6911754431728604849} + m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0} +--- !u!33 &6911754433267149341 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433267149345} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &6911754433267149340 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433267149345} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 9d815ae4d5a7b46ae99e4e5ed084d3a8, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &6911754433267149347 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433267149345} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} diff --git a/Runtime/Resources/ARFImageTrackingPrefab.prefab.meta b/Runtime/Resources/ARFImageTrackingPrefab.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..f1d093ed95b5c7706481f3e8df0c21c000245329 --- /dev/null +++ b/Runtime/Resources/ARFImageTrackingPrefab.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a69d3cd9f6cbe4a7c8b7efc56da6dce9 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Resources/ARFMeshTrackingPrefab.prefab b/Runtime/Resources/ARFMeshTrackingPrefab.prefab new file mode 100644 index 0000000000000000000000000000000000000000..6114fbe99651001e1220c8605cba10483f7e2823 --- /dev/null +++ b/Runtime/Resources/ARFMeshTrackingPrefab.prefab @@ -0,0 +1,435 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &760227130947233616 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5628977508733984536} + - component: {fileID: 1464890553281028111} + - component: {fileID: 6389761481980281444} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5628977508733984536 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 760227130947233616} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.05, y: 0.05, z: 0.05} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6911754431728604849} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &1464890553281028111 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 760227130947233616} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &6389761481980281444 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 760227130947233616} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &6911754431728604848 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6911754431728604849} + m_Layer: 0 + m_Name: ARFMeshTrackingPrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6911754431728604849 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754431728604848} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 6911754432812775763} + - {fileID: 6911754433267149346} + - {fileID: 6911754433204531549} + - {fileID: 5628977508733984536} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &6911754432812775762 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6911754432812775763} + - component: {fileID: 6911754432812775758} + - component: {fileID: 6911754432812775757} + - component: {fileID: 6911754432812775756} + m_Layer: 0 + m_Name: Z + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6911754432812775763 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754432812775762} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.0701} + m_LocalScale: {x: 0.01, y: 0.01, z: 0.11557999} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6911754431728604849} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &6911754432812775758 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754432812775762} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &6911754432812775757 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754432812775762} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 9fd9c0bd2f4f1438888297d0668f871b, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &6911754432812775756 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754432812775762} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!1 &6911754433204531548 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6911754433204531549} + - component: {fileID: 6911754433204531544} + - component: {fileID: 6911754433204531551} + - component: {fileID: 6911754433204531550} + m_Layer: 0 + m_Name: Y + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6911754433204531549 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433204531548} + serializedVersion: 2 + m_LocalRotation: {x: -0.5, y: -0.5, z: -0.5, w: 0.5} + m_LocalPosition: {x: 0, y: 0.0525, z: 0.0033} + m_LocalScale: {x: 0.0100000035, y: 0.01, z: 0.11558006} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6911754431728604849} + m_LocalEulerAnglesHint: {x: -90, y: -90.00001, z: 0} +--- !u!33 &6911754433204531544 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433204531548} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &6911754433204531551 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433204531548} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: de76e3ad692ba4492aaca3dd54e65f04, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &6911754433204531550 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433204531548} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!1 &6911754433267149345 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6911754433267149346} + - component: {fileID: 6911754433267149341} + - component: {fileID: 6911754433267149340} + - component: {fileID: 6911754433267149347} + m_Layer: 0 + m_Name: X + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6911754433267149346 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433267149345} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0.0528, y: 0, z: 0.0033} + m_LocalScale: {x: 0.01, y: 0.01, z: 0.11558} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6911754431728604849} + m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0} +--- !u!33 &6911754433267149341 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433267149345} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &6911754433267149340 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433267149345} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 9d815ae4d5a7b46ae99e4e5ed084d3a8, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &6911754433267149347 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6911754433267149345} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} diff --git a/Runtime/Resources/ARFMeshTrackingPrefab.prefab.meta b/Runtime/Resources/ARFMeshTrackingPrefab.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..f0e4eeaea6c31f65454512b329e8ca26e2a6e04c --- /dev/null +++ b/Runtime/Resources/ARFMeshTrackingPrefab.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d9c86a0dba0134e8b8cdc67291dac135 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Resources/ARFObjectLibrary.asset b/Runtime/Resources/ARFObjectLibrary.asset new file mode 100644 index 0000000000000000000000000000000000000000..a8b55ce126925a9d1663fa61448b810cf38ece10 --- /dev/null +++ b/Runtime/Resources/ARFObjectLibrary.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 85f3b71a771f04aef8057fae3964fd78, type: 3} + m_Name: ARFObjectLibrary + m_EditorClassIdentifier: + m_GuidLow: 5086418788140608333 + m_GuidHigh: 13571590907545936521 + m_ReferenceObjects: [] diff --git a/Runtime/Resources/ARFObjectLibrary.asset.meta b/Runtime/Resources/ARFObjectLibrary.asset.meta new file mode 100644 index 0000000000000000000000000000000000000000..859d8131cdd241b21b4dd1a470972060fdd23743 --- /dev/null +++ b/Runtime/Resources/ARFObjectLibrary.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 487aef79f5a474b3aa285c3d2b2d29f3 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/WorldAnalysisARFoundation.cs b/Runtime/Scripts/WorldAnalysisARFoundation.cs index 470bc318803ea5ab9dd408e0e9a99c2631170c7e..0292ec05538f7bc565d76d5ebf7404ddcee15bd2 100644 --- a/Runtime/Scripts/WorldAnalysisARFoundation.cs +++ b/Runtime/Scripts/WorldAnalysisARFoundation.cs @@ -8,10 +8,11 @@ using System.Collections; using System.Linq; using ETSI.ARF.OpenAPI.WorldStorage; using ETSI.ARF.WorldStorage.REST; +using Unity.XR.CoreUtils; //Implementation of the WorldAnalysis interface public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface -{ +{ /// /// Dictionnary of susbscription informations for poses, for each item, stored using the UUID of the item (anchor/trackable) /// @@ -26,9 +27,9 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface private Dictionary m_computedPoses; /// - /// Module Image + /// all trackable modules /// - private WorldAnalysisARFoundationModuleImage m_imageTrackableModule; + private List m_trackableModules; /// /// World Storage Info object @@ -50,6 +51,11 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface /// private bool isChekingAvailabilityRunning = false; + /// + /// Anchor manager + /// + private ARAnchorManager m_anchorManager; + /// /// Informations regarding a subscription to a pose /// @@ -69,11 +75,43 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface protected void Awake() { Instance = this; + this.gameObject.AddComponent(); m_relocalizationInformations = new Dictionary(); m_computedPoses = new Dictionary(); m_subscriptionsPoses = new Dictionary(); - m_imageTrackableModule = new WorldAnalysisARFoundationModuleImage(); - m_imageTrackableModule.Initialize(); + + m_trackableModules = new List(); + WorldAnalysisARFoundationModuleImage imageModule = new WorldAnalysisARFoundationModuleImage(); + m_trackableModules.Add(imageModule); + +#if UNITY_IOS + WorldAnalysisARFoundationModuleMesh meshModule = new WorldAnalysisARFoundationModuleMesh(); + m_trackableModules.Add(meshModule); + WorldAnalysisARFoundationModuleARKitWorldMap worldMapModule = new WorldAnalysisARFoundationModuleARKitWorldMap(); + m_trackableModules.Add(worldMapModule); +#endif +#if ETSIARF_ARCORE_EXTENSIONS + +#if UNITY_ANDROID + // 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(); + if (arCoreExtensions != null) + { + arCoreExtensions.enabled = false; + } +#endif +#endif + + foreach (WorldAnalysisARFoundationModule module in m_trackableModules) + { + module.Initialize(); + } m_storageInfo = FindObjectOfType(); m_worldStorageServer = m_storageInfo.worldStorageServer; @@ -131,12 +169,14 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface List notTrackedCandidates = new List(); //Hierarchy of types - string[] types = { "MESH", "IMAGE_MARKER", "FIDUCIAL_MARKER", "MAP", "OTHER" }; //TODO : GEOPOSE + string[] types = { "MESH", "IMAGE_MARKER", "FIDUCIAL_MARKER", "MAP", "GEOPOSE", "OTHER" }; + + List keysToRemove = new List(); //We fill in the confidence level lists. foreach (KeyValuePair relocObject in temp) { - WorldAnalysisARFoundationModule.TrackableInfo inf = m_imageTrackableModule.GetPoseTrackable(relocObject.Value.Trackable.Name); // for now only image module + WorldAnalysisARFoundationModule.TrackableInfo inf = GetPoseTrackableUUID(relocObject.Value.Trackable.UUID); // for now only image module if (inf != null) { if (inf.confidence == 100) @@ -151,9 +191,18 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface { notTrackedCandidates.Add(relocObject.Value); } + }else + { + keysToRemove.Add(relocObject.Key); } } + // Remove null trackables from temp + foreach (Guid key in keysToRemove) + { + temp.Remove(key); + } + //uses the types[] array indexes as key, and UUIDs as values List> typesSortedList = new List>(); foreach (var relocObject in temp) @@ -179,14 +228,14 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface if (bestTrackableCandidateID != Guid.Empty) { /// We have found the best trackable - WorldAnalysisARFoundationModule.TrackableInfo info = m_imageTrackableModule.GetPoseTrackable(temp[bestTrackableCandidateID].Trackable.Name); + WorldAnalysisARFoundationModule.TrackableInfo info = GetPoseTrackableUUID(temp[bestTrackableCandidateID].Trackable.UUID); if (info == null) { // For now we just ignore it : we could also send not tracked todo continue; } - Matrix4x4 tr = WorldAnalysisUnityHelper.ConvertETSIARFTransform3DToUnity(firstRelocInfo.Transform3D); + Matrix4x4 tr = WorldStorageUnityHelper.ConvertETSIARFTransform3DToUnity(firstRelocInfo.Transform3D); // Changed to WS / SylR UnityEngine.Vector3 tr_trans = WorldAnalysisUnityHelper.ExtractTranslationFromMatrix(tr); UnityEngine.Quaternion tr_rot = WorldAnalysisUnityHelper.ExtractRotationFromMatrix(tr); @@ -294,7 +343,6 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface return PoseEstimationResult.OK; } - public PoseEstimationResult[] GetLastPoses(string token, Guid[] uuids, Mode_WorldAnalysis[] modes, out ETSI.ARF.OpenAPI.WorldAnalysis.Pose[] poses) { if (uuids.Length != modes.Length) @@ -315,7 +363,6 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface return resul; } - public InformationSubscriptionResult SubscribeToPose(string token, Guid uuid, Mode_WorldAnalysis mode, PoseCallback callback, ref int validity, out Guid subscriptionUUID) { RelocalizationInformation relocInfo = null; @@ -340,11 +387,19 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface List capabilities = new List(); foreach (ETSI.ARF.OpenAPI.WorldAnalysis.Capability capability in currentCapabilities) { - capabilities.Add(WorldAnalysisUnityHelper.ConvertWorldAnalysisCapability(capability)); + if(capability != null) + { + capabilities.Add(WorldAnalysisUnityHelper.ConvertWorldAnalysisCapability(capability)); + } } + /// Collect relocalization information - ETSI.ARF.OpenAPI.WorldStorage.Response response = RelocalizationInformationRequest.GetRelocalizationInformation(m_worldStorageServer, uuids, modes, capabilities); + ETSI.ARF.OpenAPI.WorldStorage.RelocalizationInformations response = RelocalizationInformationRequest.GetRelocalizationInformation(m_worldStorageServer, uuids, modes, capabilities); + if(response == null) + { + Debug.Log("ETSI ARF GetRelocalizationInformation : request response is null"); + } relocInfo = response.RelocInfo.First(); //Only one uuid requested } else @@ -358,7 +413,6 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface /// Subscription not possible return InformationSubscriptionResult.NONE; } - return CreateSubscriptionWithRelocalizationInformation(relocInfo, uuid, mode, callback, ref validity, out subscriptionUUID); } @@ -395,7 +449,7 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface l_modes.Add(Mode_WorldStorage.TRACKABLES_TO_REQUEST); } /// Collect relocalization information - ETSI.ARF.OpenAPI.WorldStorage.Response response = RelocalizationInformationRequest.GetRelocalizationInformation(m_worldStorageServer, l_uuids, l_modes, capabilities); + ETSI.ARF.OpenAPI.WorldStorage.RelocalizationInformations response = RelocalizationInformationRequest.GetRelocalizationInformation(m_worldStorageServer, l_uuids, l_modes, capabilities); /// Check every reloc information object foreach (RelocalizationInformation relocInfo in response.RelocInfo) @@ -452,7 +506,7 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface } } - public InformationSubscriptionResult UnSubscribeToPose(Guid subscriptionUUID) + public InformationSubscriptionResult UnsubscribeFromPose(Guid subscriptionUUID) { if (m_subscriptionsPoses.ContainsKey(subscriptionUUID)) { @@ -469,19 +523,9 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface { List capabilitiesList = new List(); - /// Image Tracking - if (m_imageTrackableModule != null) - { - ETSI.ARF.OpenAPI.WorldAnalysis.Capability capabilityImage = new ETSI.ARF.OpenAPI.WorldAnalysis.Capability(); - capabilityImage.TrackableType = ETSI.ARF.OpenAPI.WorldAnalysis.TrackableType.IMAGE_MARKER; - ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure encodingInformation = new ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure(); - encodingInformation.DataFormat = ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructureDataFormat.OTHER; - encodingInformation.Version = "1.01"; - capabilityImage.EncodingInformation = encodingInformation; - capabilityImage.Framerate = 30; // Not particularly specified on ARKit and ARCore - capabilityImage.Latency = 0; // Not particularly specified on ARKit and ARCore - capabilityImage.Accuracy = 1; // Not particularly specified on ARKit and ARCore - capabilitiesList.Add(capabilityImage); + foreach(WorldAnalysisARFoundationModule module in m_trackableModules) + { + capabilitiesList.Add(module.GetSupportedCapability()); } capabilities = capabilitiesList.ToArray(); @@ -501,6 +545,25 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface #region Helper + /// + /// Find in all modules the tracking info of a trackable with its name + /// + /// + /// Tracking info if found else null + private WorldAnalysisARFoundationModule.TrackableInfo GetPoseTrackableUUID(Guid uuid) + { + foreach (WorldAnalysisARFoundationModule module in m_trackableModules) + { + ///Improve latter : not good to check all modules + WorldAnalysisARFoundationModule.TrackableInfo info = module.GetPoseTrackable(uuid); + if (info !=null) + { + return info ; + } + } + return null ; + } + /// /// To select the best trackable /// @@ -510,7 +573,7 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface /// private Guid SelectTrackableWithTypeAndDistance(List candidates, List> typesSortedList, UnityEngine.Vector3 cameraTransformPos) { - float bestDistance = 100.0f; //valeur par défaut = grande distance (ŕ changer) + float bestDistance = 10000000.0f; //default value : long distance (to change ?) Guid selectedTrackableUUID = Guid.Empty; //if only one trackable is candidate @@ -553,7 +616,7 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface // select the corresponding candidate from the list of candidates if (tmp.Trackable.UUID == distanceCandidate) { - WorldAnalysisARFoundationModule.TrackableInfo inf = m_imageTrackableModule.GetPoseTrackable(tmp.Trackable.Name); + WorldAnalysisARFoundationModule.TrackableInfo inf = GetPoseTrackableUUID(tmp.Trackable.UUID); float distance = UnityEngine.Vector3.Distance(cameraTransformPos, inf.position); @@ -568,7 +631,6 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface } } } - return selectedTrackableUUID; } @@ -578,10 +640,9 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface bool hasSupport = false; foreach (RelocObjects relocObj in relocInfo.RelocObjects) { - /// We try to find a supported trackable - if (relocObj.Trackable.TrackableType == ETSI.ARF.OpenAPI.WorldStorage.TrackableType.IMAGE_MARKER) + foreach(WorldAnalysisARFoundationModule module in m_trackableModules) { - hasSupport |= m_imageTrackableModule.AddTrackable(relocObj.Trackable); + hasSupport |= module.AddTrackable(relocObj.Trackable); } } diff --git a/Runtime/Scripts/WorldAnalysisARFoundationCoroutineHelper.cs b/Runtime/Scripts/WorldAnalysisARFoundationCoroutineHelper.cs new file mode 100644 index 0000000000000000000000000000000000000000..b240bde546727c4f19b6969cf2b3efb8ee7f6d7d --- /dev/null +++ b/Runtime/Scripts/WorldAnalysisARFoundationCoroutineHelper.cs @@ -0,0 +1,25 @@ +using System.Collections; +using UnityEngine; + +public class WorldAnalysisARFoundationCoroutineHelper : MonoBehaviour +{ + //Singleton + public static WorldAnalysisARFoundationCoroutineHelper Instance { get; private set; } + + private void Awake() + { + if (Instance != null && Instance != this) + { + Destroy(this); + } + else + { + Instance = this; + } + } + + public void StartACoroutine(IEnumerator coroutine) + { + StartCoroutine(coroutine); + } +} \ No newline at end of file diff --git a/Runtime/Scripts/WorldAnalysisARFoundationCoroutineHelper.cs.meta b/Runtime/Scripts/WorldAnalysisARFoundationCoroutineHelper.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..9d9455dc23e9f6e0534f1b5006fcda57d18846e1 --- /dev/null +++ b/Runtime/Scripts/WorldAnalysisARFoundationCoroutineHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bba8c444e6fa865469446e417be28e45 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/WorldAnalysisARFoundationHelper.cs b/Runtime/Scripts/WorldAnalysisARFoundationHelper.cs new file mode 100644 index 0000000000000000000000000000000000000000..f3bb1771cf1ad0a059b720e345c1272feca871a6 --- /dev/null +++ b/Runtime/Scripts/WorldAnalysisARFoundationHelper.cs @@ -0,0 +1,48 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System.Threading.Tasks; +using System.Net ; +using System.IO ; + +public class WorldAnalysisARFoundationHelper +{ + /// + /// Downaload file http + /// + /// load url + /// key and value with local path and file name with extension + public static async Task > DownloadFileHTTP(string toLoad) + { + string filePath = ""; + string fileName = ""; + #if UNITY_EDITOR + string folder = Application.streamingAssetsPath; +#else + string folder = Application.persistentDataPath; +#endif + + string uniqueFileName = "/Temp"+ System.Guid.NewGuid()+".data"; + using (var client = new WebClient()) + { + await client.DownloadFileTaskAsync(toLoad, folder + uniqueFileName); + string header_contentDisposition = client.ResponseHeaders["content-disposition"]; + if (header_contentDisposition == null) + { + string[] splittedLink = toLoad.Split('/'); + fileName = splittedLink[splittedLink.Length - 1]; + } + else + { + fileName = new System.Net.Mime.ContentDisposition(header_contentDisposition).FileName; + } + filePath = folder + "/" + fileName; + if (File.Exists(filePath)) + { + File.Delete(filePath); + } + File.Move(folder + uniqueFileName, filePath); + } + return new KeyValuePair(filePath , fileName); + } +} diff --git a/Runtime/Scripts/WorldAnalysisARFoundationHelper.cs.meta b/Runtime/Scripts/WorldAnalysisARFoundationHelper.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..5602d29efe0f7fa6755a7982cc579fae4bc483a9 --- /dev/null +++ b/Runtime/Scripts/WorldAnalysisARFoundationHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a7db7bb6556864f8a99c9e7d104f85df +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/WorldAnalysisARFoundationModule.cs b/Runtime/Scripts/WorldAnalysisARFoundationModule.cs index 3951fcc63ee5c09b76bcac3c421547b714c61dd2..70740465a1def6bfe12eaf378fd7fb85dc1507ff 100644 --- a/Runtime/Scripts/WorldAnalysisARFoundationModule.cs +++ b/Runtime/Scripts/WorldAnalysisARFoundationModule.cs @@ -1,4 +1,5 @@ using UnityEngine; +using System; public interface WorldAnalysisARFoundationModule { @@ -29,9 +30,15 @@ public interface WorldAnalysisARFoundationModule public bool AddTrackable(ETSI.ARF.OpenAPI.WorldStorage.Trackable trackable); /// - /// + /// Get the pose of the trackable from its uuid /// - /// - public TrackableInfo GetPoseTrackable(string name); + /// id of the trackable + /// null or trackableInfo with last updated values + public TrackableInfo GetPoseTrackable(Guid uuid); + + /// + /// Initialize capability object with the features of the module + /// + public ETSI.ARF.OpenAPI.WorldAnalysis.Capability GetSupportedCapability(); } \ No newline at end of file diff --git a/Runtime/Scripts/WorldAnalysisARFoundationModuleARCoreAnchor.cs b/Runtime/Scripts/WorldAnalysisARFoundationModuleARCoreAnchor.cs new file mode 100644 index 0000000000000000000000000000000000000000..15a1ac313adfc5d10769f401f97da4988e9ab432 --- /dev/null +++ b/Runtime/Scripts/WorldAnalysisARFoundationModuleARCoreAnchor.cs @@ -0,0 +1,189 @@ +#if UNITY_ANDROID && ETSIARF_ARCORE_EXTENSIONS +using System; +using System.Collections; +using System.Collections.Generic; +using Google.XR.ARCoreExtensions; +using Unity.XR.CoreUtils; +using UnityEngine; +using UnityEngine.XR.ARFoundation; +using UnityEngine.XR.ARSubsystems; +using static WorldAnalysisARFoundationModule; + +public class WorldAnalysisARFoundationModuleARCoreAnchor : WorldAnalysisARFoundationModule +{ + /// + /// Anchor manager + /// + private ARAnchorManager m_anchorManager; + /// + /// List of cloud anchors with tracking infos + /// + private Dictionary m_trackedCloudAnchors = new Dictionary(); + /// + /// Correspondance between local trackable and etsi uuid + /// + private Dictionary m_localIdToEtsiId = new Dictionary(); + + /// + /// Initialize ARCore cloud anchors tracking module + /// + public void Initialize() + { + XROrigin origin = UnityEngine.Object.FindAnyObjectByType(); + m_anchorManager = origin.gameObject.GetComponent(); + if (m_anchorManager == null ) + { + m_anchorManager = origin.gameObject.AddComponent(); + GameObject anchorPrefab = (GameObject)Resources.Load("ARFAnchorTrackingPrefab"); + m_anchorManager.anchorPrefab = anchorPrefab; + } + m_anchorManager.anchorsChanged += OnTrackedCloudAnchorChanged; + } + + /// + /// Get the pose of the trackable from its uuid + /// + /// id of the trackable + /// null or trackableInfo with last updated values + public TrackableInfo GetPoseTrackable(Guid uuid) + { + if (m_trackedCloudAnchors.ContainsKey(uuid.ToString())) + { + return m_trackedCloudAnchors[uuid.ToString()]; + } + else + { + return null; + } + } + + /// + /// Need to be a map + /// + /// + /// map or not (does not check is solved) + public bool AddTrackable(ETSI.ARF.OpenAPI.WorldStorage.Trackable trackable) + { + /// Here : we don't check if the trackable is allready added + if (trackable.TrackableType != ETSI.ARF.OpenAPI.WorldStorage.TrackableType.MAP) + { + return false; + } + AddNewARCoreCloudAnchor(trackable); // here we don't check if the cloud anchor is correctly resolved, this could be imrpoved but would require this method to be async (change of api) + return true; + } + + /// + /// Initialize capability object with the features of the arcore cloud anchor module + /// + /// a Capability object + public ETSI.ARF.OpenAPI.WorldAnalysis.Capability GetSupportedCapability() + { + ETSI.ARF.OpenAPI.WorldAnalysis.Capability capabilityARCoreAnchor = new ETSI.ARF.OpenAPI.WorldAnalysis.Capability(); + capabilityARCoreAnchor.TrackableType = ETSI.ARF.OpenAPI.WorldAnalysis.TrackableType.MAP; + ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure encodingInformation = new ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure(); + encodingInformation.DataFormat = ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructureDataFormat.ARCORE; + encodingInformation.Version = "1.01"; + capabilityARCoreAnchor.EncodingInformation = encodingInformation; + capabilityARCoreAnchor.Framerate = 30; // Not particularly specified on ARKit and ARCore + capabilityARCoreAnchor.Latency = 0; // Not particularly specified on ARKit and ARCore + capabilityARCoreAnchor.Accuracy = 1; // Not particularly specified on ARKit and ARCore + return capabilityARCoreAnchor; + } + + /// + /// Update arcore cloud anchors informations + /// + /// + private void OnTrackedCloudAnchorChanged(ARAnchorsChangedEventArgs eventArgs) + { + foreach (var trackedCloudAnchor in eventArgs.updated) + { + 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? + if (m_localIdToEtsiId.ContainsKey(localId)) + { + info.name = m_localIdToEtsiId[localId]; + } + else + { + Debug.Log("ARCore Cloud Anchor No correspondance for Local Anchor " + localId); + continue; + } + + if (trackedCloudAnchor.trackingState == TrackingState.Tracking) + { + info.state = ETSI.ARF.OpenAPI.WorldAnalysis.PoseEstimationState.OK; + info.confidence = 100; + } + else if (trackedCloudAnchor.trackingState == TrackingState.Limited) + { + info.state = ETSI.ARF.OpenAPI.WorldAnalysis.PoseEstimationState.OK; + info.confidence = 50; + } + else + { + info.state = ETSI.ARF.OpenAPI.WorldAnalysis.PoseEstimationState.FAILURE; //ADD NOT_TRACKED ? + info.confidence = 0; + } + info.timeStamp = unchecked((int)DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()); + info.position = position; + info.rotation = rotation; + info.trackableType = ETSI.ARF.OpenAPI.WorldAnalysis.TrackableType.MAP; + m_trackedCloudAnchors[info.name] = info; + } + } + + /// + /// Create a new ARCore Cloud anchor using ARCore API id + /// + /// + private async void AddNewARCoreCloudAnchor(ETSI.ARF.OpenAPI.WorldStorage.Trackable trackable) + { + while (ARSession.state == ARSessionState.CheckingAvailability || ARSession.state == ARSessionState.None ||ARSession.state == ARSessionState.SessionInitializing) + { + await System.Threading.Tasks.Task.Delay(100); + } + string googleCloudID = trackable.Name; + ResolveCloudAnchor(googleCloudID, trackable.UUID.ToString()); + } + + /// + /// Resolves Cloud Anchors using a given id + /// + /// + public void ResolveCloudAnchor(string cloudId, string etsiId) + { + var promise = m_anchorManager.ResolveCloudAnchorAsync(cloudId); + if (promise.State == PromiseState.Done) + { + Debug.Log("Failed to resolve Cloud Anchor " + cloudId); + } + else + { + var coroutine = ResolveAnchor(promise, cloudId, etsiId); + WorldAnalysisARFoundationCoroutineHelper.Instance.StartACoroutine(coroutine); + } + } + + /// + /// Resolves cloud anchor promise + /// + /// + /// + private IEnumerator ResolveAnchor(ResolveCloudAnchorPromise promise, string cloudId, string etsiId) + { + yield return promise; + var result = promise.Result; + if (result.CloudAnchorState == CloudAnchorState.Success) + { + 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 + } + } +} + +#endif \ No newline at end of file diff --git a/Runtime/Scripts/WorldAnalysisARFoundationModuleARCoreAnchor.cs.meta b/Runtime/Scripts/WorldAnalysisARFoundationModuleARCoreAnchor.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..9e979e937c28e06821071d940c409c59fd2d374e --- /dev/null +++ b/Runtime/Scripts/WorldAnalysisARFoundationModuleARCoreAnchor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2cec98c043216c94db7d09c20b3cce67 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/WorldAnalysisARFoundationModuleARKitWorldMap.cs b/Runtime/Scripts/WorldAnalysisARFoundationModuleARKitWorldMap.cs new file mode 100644 index 0000000000000000000000000000000000000000..7019f3a9ca0a193427f4217de0e56e17d5eb1644 --- /dev/null +++ b/Runtime/Scripts/WorldAnalysisARFoundationModuleARKitWorldMap.cs @@ -0,0 +1,238 @@ + +#if UNITY_IOS +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.XR.ARFoundation; +using UnityEngine.XR.ARSubsystems; +using UnityEngine.XR.ARKit; +using System.IO; +using Unity.XR.CoreUtils; +using static WorldAnalysisARFoundationModule; +using ETSI.ARF.OpenAPI.WorldStorage; +using Unity.Collections; + + +public class WorldAnalysisARFoundationModuleARKitWorldMap : WorldAnalysisARFoundationModule +{ + /// + /// Anchor manager + /// + private ARAnchorManager m_anchorManager; + ///Has loaded a worl map + private bool m_hasAddedMap ; + /// Possible trackable id (arfoundation) of an anchor contained in the world map. Take the pose of this anchor if it exists or zero + private string m_arfoundationAnchorTrackableId ; + /// uuId of the map trackabled + private Guid m_trackedUUID ; + /// computed and updated pose + private TrackableInfo m_trackedPose ; + + /// + /// Initialize image tracking module + /// + public void Initialize() + { + XROrigin origin = UnityEngine.Object.FindAnyObjectByType(); + m_anchorManager = origin.gameObject.AddComponent(); + GameObject anchorPrefab = (GameObject)Resources.Load("ARFAnchorTrackingPrefab"); + m_anchorManager.anchorPrefab = anchorPrefab; + m_anchorManager.anchorsChanged += OnTrackedAnchorChanged; + m_trackedPose = null ; + m_hasAddedMap= false ; + } + + /// + /// found + /// + /// name of the mesh trackable + public TrackableInfo GetPoseTrackable(Guid uuid) + { + if (m_trackedPose != null) + { + if (m_trackedUUID == uuid) + { + return m_trackedPose ; + } + } + return null; + } + + /// + /// Add a trackable : need to be a map + /// + /// Image trackable + /// Supported or not + public bool AddTrackable(Trackable trackable) + { + if (trackable.TrackableType != ETSI.ARF.OpenAPI.WorldStorage.TrackableType.MAP) + { + return false; + } + if (m_hasAddedMap) + { + Debug.Log("Only one ARKit map can be loaded"); + return false ; + } + + // Check if a map url is provided + string url = "" ; + if (trackable.KeyvalueTags.ContainsKey("url")) + { + foreach(string s in trackable.KeyvalueTags["url"]) + { + // first one + url = s ; + break ; + } + } + bool resul = AddWorldMapToARKit(url); + m_trackedUUID = trackable.UUID ; + m_arfoundationAnchorTrackableId = trackable.Name ; + m_hasAddedMap = resul ; + return resul; + } + + /// + /// Initialize capability object with Mesh tracking + /// + public ETSI.ARF.OpenAPI.WorldAnalysis.Capability GetSupportedCapability() + { + ETSI.ARF.OpenAPI.WorldAnalysis.Capability capabilityMesh = new ETSI.ARF.OpenAPI.WorldAnalysis.Capability(); + capabilityMesh.TrackableType = ETSI.ARF.OpenAPI.WorldAnalysis.TrackableType.MAP; + ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure encodingInformation = new ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure(); + encodingInformation.DataFormat = ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructureDataFormat.ARKIT; + encodingInformation.Version = "1.01"; + capabilityMesh.EncodingInformation = encodingInformation; + capabilityMesh.Framerate = 30; // Not particularly specified on ARKit + capabilityMesh.Latency = 0; // Not particularly specified on ARKit + capabilityMesh.Accuracy = 1; // Not particularly specified on ARKit + return capabilityMesh ; + } + + /// + /// Callback when Unity anchors are updated + /// + /// update values + private void OnTrackedAnchorChanged(ARAnchorsChangedEventArgs eventArgs) + { + foreach (var trackedAnchor in eventArgs.updated) + { + Debug.Log("Anchor found " +trackedAnchor.trackableId.ToString()); + + if (trackedAnchor.trackableId.ToString() == m_arfoundationAnchorTrackableId) + { + /// look for an anchor with the trackable Id correspond to the ETSI ARF trackable name + UpdateTrackableInfoWithPose(trackedAnchor.transform.position,trackedAnchor.transform.rotation); + break ; + } + } + } + + /// + /// Add a map to arkitsubsystem : check local file exist or download from given url + /// + /// url of a map to download + /// found or not + protected bool AddWorldMapToARKit(string url) + { + if (url.Length > 0) + { + Debug.Log("Load AR Map from URL"); + LoadWorldMapFromURL(url); + // don't check if url is valid + return true ; + } + else + { + Debug.Log("Load AR Map locally"); + string localMap = Application.persistentDataPath + "/ARkitWorlMap.map"; + if (File.Exists(localMap)) + { + var coroutine = CoroutineLoadWorldMap(localMap); + WorldAnalysisARFoundationCoroutineHelper.Instance.StartACoroutine(coroutine); + return true ; + } + } + // no url and no local map + return false ; + } + + /// + /// Update pose of the map trackable + /// + /// evaluated position of trackable/param> + /// evaluated rotation of the trackable + private void UpdateTrackableInfoWithPose(Vector3 position, Quaternion rotation) + { + m_trackedPose = new TrackableInfo(); + m_trackedPose.name = m_arfoundationAnchorTrackableId; + m_trackedPose.state = ETSI.ARF.OpenAPI.WorldAnalysis.PoseEstimationState.OK; // here : could check the state of the ARKit slam + m_trackedPose.confidence = 100; + m_trackedPose.timeStamp = unchecked((int)DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()); + m_trackedPose.position = position; + m_trackedPose.rotation = rotation; + m_trackedPose.trackableType = ETSI.ARF.OpenAPI.WorldAnalysis.TrackableType.MAP; + } + + /// + /// Load a world map from a url + /// + /// url to the worlmap to download + private async void LoadWorldMapFromURL(string url) + { + Debug.Log("Download WorlMap from url "+ url); + KeyValuePair downloaded = await WorldAnalysisARFoundationHelper.DownloadFileHTTP(url); + var coroutine = CoroutineLoadWorldMap(downloaded.Key); + WorldAnalysisARFoundationCoroutineHelper.Instance.StartACoroutine(coroutine); + } + + /// + /// Load current map from path + /// + /// path of the map + /// coroutine + public IEnumerator CoroutineLoadWorldMap(string mapPath) + { + while (ARSession.state == ARSessionState.CheckingAvailability || ARSession.state == ARSessionState.None ||ARSession.state == ARSessionState.SessionInitializing) + { + // wait for ar session to be ready + yield return null ; + } + + ARSession session = Component.FindAnyObjectByType() ; + ARKitSessionSubsystem sessionSubsystem = (ARKitSessionSubsystem)session.subsystem; + if (sessionSubsystem == null) + { + Debug.Log("Cannot load map: no ARKitSessionSubsystem"); + } + else + { + FileStream file; + file = File.Open(mapPath, FileMode.Open); + const int bytesPerFrame = 1024 * 10; + var bytesRemaining = file.Length; + var binaryReader = new BinaryReader(file); + var allBytes = new List(); + while (bytesRemaining > 0) + { + var bytes = binaryReader.ReadBytes(bytesPerFrame); + allBytes.AddRange(bytes); + bytesRemaining -= bytesPerFrame; + yield return null; + } + + var data = new NativeArray(allBytes.Count, Allocator.Temp); + data.CopyFrom(allBytes.ToArray()); + ARWorldMap worldMap; + if (ARWorldMap.TryDeserialize(data, out worldMap)) + { + data.Dispose(); + } + sessionSubsystem.ApplyWorldMap(worldMap); + //UpdateTrackableInfoWithPose(Vector3.zero, Quaternion.identity); // before trying to find an anchor: default pause is origin of the map + } + } +} +#endif \ No newline at end of file diff --git a/Runtime/Scripts/WorldAnalysisARFoundationModuleARKitWorldMap.cs.meta b/Runtime/Scripts/WorldAnalysisARFoundationModuleARKitWorldMap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ac4deffed588a7e065ead2b93a49a0a13fcd1f43 --- /dev/null +++ b/Runtime/Scripts/WorldAnalysisARFoundationModuleARKitWorldMap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0eb5e51c9f2ae4e8db0c43c245bf7b41 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/WorldAnalysisARFoundationModuleGeospatial.cs b/Runtime/Scripts/WorldAnalysisARFoundationModuleGeospatial.cs new file mode 100644 index 0000000000000000000000000000000000000000..6a8c0936e4ddaacd2496f852251a6e4ad66540b0 --- /dev/null +++ b/Runtime/Scripts/WorldAnalysisARFoundationModuleGeospatial.cs @@ -0,0 +1,206 @@ +#if UNITY_ANDROID && ETSIARF_ARCORE_EXTENSIONS +using System; +using System.Collections.Generic; +using Google.XR.ARCoreExtensions; +using Unity.XR.CoreUtils; +using UnityEngine; +using UnityEngine.XR.ARFoundation; +using UnityEngine.XR.ARSubsystems; +using static WorldAnalysisARFoundationModule; + +public class WorldAnalysisARFoundationModuleGeospatial : WorldAnalysisARFoundationModule +{ + /// + /// Anchor manager + /// + private ARAnchorManager m_anchorManager; + + /// + /// Earth manager + /// + private AREarthManager m_arEarthManager; + + /// + /// List of geospatial anchors with tracking infos + /// + private Dictionary m_trackedGeospatialAnchors = new Dictionary(); + + /// + /// Correspondance between local trackable and etsi uuid + /// + private Dictionary m_localIdToEtsiId = new Dictionary(); + + /// + /// Check if ARCore Geospatial is supported on the device + /// + private bool geospatialSupported = true; + + /// + /// Initialize ARCore geospatial anchors tracking module + /// + public void Initialize() + { + XROrigin origin = UnityEngine.Object.FindAnyObjectByType(); + m_anchorManager = origin.gameObject.GetComponent(); + if (m_anchorManager == null) + { + m_anchorManager = origin.gameObject.AddComponent(); + GameObject anchorPrefab = (GameObject)Resources.Load("ARFAnchorTrackingPrefab"); + m_anchorManager.anchorPrefab = anchorPrefab; + } + m_arEarthManager = origin.gameObject.AddComponent(); + m_anchorManager.anchorsChanged += OnTrackedGeospatialAnchorChanged; + } + + /// + /// Get the pose of the trackable from its uuid + /// + /// id of the trackable + /// null or trackableInfo with last updated values + public TrackableInfo GetPoseTrackable(Guid uuid) + { + if (m_trackedGeospatialAnchors.ContainsKey(uuid.ToString())) + { + return m_trackedGeospatialAnchors[uuid.ToString()]; + } + else + { + return null; + } + } + + /// + /// Need to be a geopose + /// + /// + /// geopose or not (does not check is solved) + public bool AddTrackable(ETSI.ARF.OpenAPI.WorldStorage.Trackable trackable) + { + Debug.Log("GEO : Add Geosptial Trackable"); + if (!geospatialSupported) return false; + + if (trackable.TrackableType != ETSI.ARF.OpenAPI.WorldStorage.TrackableType.GEOPOSE) + { + return false; + } + CreateGeosptialAnchor(trackable); + + return true; + } + + /// + /// Initialize capability object with the features of the geospatial module + /// + /// null if ARCore Geospatial is not supported on the device, or a Capability object + public ETSI.ARF.OpenAPI.WorldAnalysis.Capability GetSupportedCapability() + { + if (!geospatialSupported) return null; + + ETSI.ARF.OpenAPI.WorldAnalysis.Capability capabilityGeospatialAnchor = new ETSI.ARF.OpenAPI.WorldAnalysis.Capability(); + capabilityGeospatialAnchor.TrackableType = ETSI.ARF.OpenAPI.WorldAnalysis.TrackableType.GEOPOSE; + ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure encodingInformation = new ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure(); + encodingInformation.DataFormat = ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructureDataFormat.ARCORE; + encodingInformation.Version = "1.01"; + capabilityGeospatialAnchor.EncodingInformation = encodingInformation; + capabilityGeospatialAnchor.Framerate = 30; // Not particularly specified on ARKit and ARCore + capabilityGeospatialAnchor.Latency = 0; // Not particularly specified on ARKit and ARCore + capabilityGeospatialAnchor.Accuracy = 1; // Not particularly specified on ARKit and ARCore + return capabilityGeospatialAnchor; + } + + /// + /// Creates a new ARCore Geospatial anchor using informations from a geopose trackable object + /// + /// + public async void CreateGeosptialAnchor(ETSI.ARF.OpenAPI.WorldStorage.Trackable trackable) + { + + double[] values = new double[trackable.TrackablePayload.Length / sizeof(double)]; + + for (int i = 0; i < values.Length; i++) + { + values[i] = BitConverter.ToDouble(trackable.TrackablePayload, i * sizeof(double)); + } + + if (geospatialSupported) + { + while (ARSession.state == ARSessionState.CheckingAvailability || ARSession.state == ARSessionState.None || ARSession.state == ARSessionState.SessionInitializing || m_arEarthManager.EarthState != EarthState.Enabled || m_arEarthManager.EarthTrackingState != TrackingState.Tracking) + { + Debug.Log("Geo : checking " + ARSession.state + " " + m_arEarthManager.EarthState + " " + m_arEarthManager.EarthTrackingState); + await System.Threading.Tasks.Task.Delay(100); + } + if (m_arEarthManager.IsGeospatialModeSupported(GeospatialMode.Enabled) != FeatureSupported.Supported) + { + geospatialSupported = false; + Debug.Log("Geo : not supported"); + } + else + { + values = new double[trackable.TrackablePayload.Length / sizeof(double)]; + + for (int i = 0; i < values.Length; i++) + { + values[i] = BitConverter.ToDouble(trackable.TrackablePayload, i * sizeof(double)); + } + + Quaternion rotation = Quaternion.Euler((float)values[3], (float)values[4], (float)values[5]); + + if (m_arEarthManager.EarthTrackingState == TrackingState.Tracking) + { + var anchor = m_anchorManager.AddAnchor(values[0], values[1], values[2], rotation); + m_localIdToEtsiId.Add(anchor.trackableId.subId2.ToString("X16"), trackable.UUID.ToString()); + } + } + } + } + + /// + /// Update geospatial anchors informations + /// + /// Event arguments for the event + private void OnTrackedGeospatialAnchorChanged(ARAnchorsChangedEventArgs eventArgs) + { + foreach (var trackedGeospatialAnchor in eventArgs.updated) + { + Vector3 position = trackedGeospatialAnchor.transform.position; + Quaternion rotation = trackedGeospatialAnchor.transform.rotation; + + TrackableInfo info = new TrackableInfo(); + info.name = trackedGeospatialAnchor.name; + string localId = trackedGeospatialAnchor.trackableId.subId1.ToString("X16");// there must be a better way : does it work every time? + + if (m_localIdToEtsiId.ContainsKey(localId)) + { + info.name = m_localIdToEtsiId[localId]; + } + else + { + //Debug.Log("ARCore Geospatial Anchor No correspondance for Local Anchor " + localId); + continue; + } + + if (trackedGeospatialAnchor.trackingState == TrackingState.Tracking) + { + info.state = ETSI.ARF.OpenAPI.WorldAnalysis.PoseEstimationState.OK; + info.confidence = 100; + } + else if (trackedGeospatialAnchor.trackingState == TrackingState.Limited) + { + info.state = ETSI.ARF.OpenAPI.WorldAnalysis.PoseEstimationState.OK; + info.confidence = 50; + } + else + { + info.state = ETSI.ARF.OpenAPI.WorldAnalysis.PoseEstimationState.FAILURE; //ADD NOT_TRACKED ? + info.confidence = 0; + } + info.timeStamp = unchecked((int)DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()); + info.position = position; + info.rotation = rotation; + info.trackableType = ETSI.ARF.OpenAPI.WorldAnalysis.TrackableType.GEOPOSE; + + m_trackedGeospatialAnchors[info.name] = info; + } + } +} +#endif \ No newline at end of file diff --git a/Runtime/Scripts/WorldAnalysisARFoundationModuleGeospatial.cs.meta b/Runtime/Scripts/WorldAnalysisARFoundationModuleGeospatial.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..205e77f412b5355ae1d8f3f45be7712131cc49ce --- /dev/null +++ b/Runtime/Scripts/WorldAnalysisARFoundationModuleGeospatial.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2230c312c9cd04c488d9d8a3e058f39b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/WorldAnalysisARFoundationModuleImage.cs b/Runtime/Scripts/WorldAnalysisARFoundationModuleImage.cs index e7da9b28494ef549c2aec30f87419464b43beef3..ab15c6e30490d90212a7ab2c4c703835ebfc7e5d 100644 --- a/Runtime/Scripts/WorldAnalysisARFoundationModuleImage.cs +++ b/Runtime/Scripts/WorldAnalysisARFoundationModuleImage.cs @@ -17,15 +17,19 @@ public class WorldAnalysisARFoundationModuleImage : WorldAnalysisARFoundationMod /// /// Name of all images that have been added to the library /// - private List m_trackedImageInLibrary; + private List m_trackedImageInLibrary; + /// + /// All url of images that have allready been downloaded + /// + private List m_allDownloadedImages; /// /// List of tracked images with tracking infos /// private Dictionary m_trackedImages = new Dictionary(); /// - /// Default Constructor + /// Link between trackable name and uuid /// - public WorldAnalysisARFoundationModuleImage() { } + private Dictionary m_uuidToName = new Dictionary(); /// /// Initialize image tracking module @@ -35,25 +39,26 @@ public class WorldAnalysisARFoundationModuleImage : WorldAnalysisARFoundationMod XROrigin origin = UnityEngine.Object.FindAnyObjectByType(); m_trackedImageManager = origin.gameObject.AddComponent(); m_trackedImageInLibrary = new List(); + m_allDownloadedImages = new List(); m_trackedImageManager.trackedImagePrefab = (GameObject)Resources.Load("ARFImageTrackingPrefab"); m_trackedImageManager.trackedImagesChanged += OnTrackedImagesChanged; } /// - /// found : pourrait aussi tracké pas tracké, on pourrait aussi ajouter la cofiance si dispo dans l'API + /// found /// - /// name of the image trackable - - public TrackableInfo GetPoseTrackable(string name) + /// name of the image trackable + public TrackableInfo GetPoseTrackable(Guid uuid) { - if (m_trackedImages.ContainsKey(name)) - { - return m_trackedImages[name]; - } - else + if (m_uuidToName.ContainsKey(uuid)) { - return null; + string name = m_uuidToName[uuid]; + if (m_trackedImages.ContainsKey(name)) + { + return m_trackedImages[name]; + } } + return null; } /// @@ -68,8 +73,42 @@ public class WorldAnalysisARFoundationModuleImage : WorldAnalysisARFoundationMod { return false; } - AddImageToLibrary(trackable.Name, (float)trackable.TrackableSize[0]); - return true; + + // Check if an image url is provided + string url = "" ; + if (trackable.KeyvalueTags.ContainsKey("url")) + { + foreach(string s in trackable.KeyvalueTags["url"]) + { + // first one + url = s ; + break ; + } + } + + bool resul = AddImageToLibrary(trackable.Name, url, (float)trackable.TrackableSize[0]); + if (resul) + { + m_uuidToName[trackable.UUID] = trackable.Name; + } + return resul; + } + + /// + /// Initialize capability object with image tracking + /// + public ETSI.ARF.OpenAPI.WorldAnalysis.Capability GetSupportedCapability() + { + ETSI.ARF.OpenAPI.WorldAnalysis.Capability capabilityImage = new ETSI.ARF.OpenAPI.WorldAnalysis.Capability(); + capabilityImage.TrackableType = ETSI.ARF.OpenAPI.WorldAnalysis.TrackableType.IMAGE_MARKER; + ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure encodingInformation = new ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure(); + encodingInformation.DataFormat = ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructureDataFormat.OTHER; + encodingInformation.Version = "1.01"; + capabilityImage.EncodingInformation = encodingInformation; + capabilityImage.Framerate = 30; // Not particularly specified on ARKit and ARCore + capabilityImage.Latency = 0; // Not particularly specified on ARKit and ARCore + capabilityImage.Accuracy = 1; // Not particularly specified on ARKit and ARCore + return capabilityImage; } /// @@ -112,9 +151,10 @@ public class WorldAnalysisARFoundationModuleImage : WorldAnalysisARFoundationMod /// Add a new image to the arfoundation library /// /// file name + /// potential url /// image width in meters - /// - protected bool AddImageToLibrary(string fileName, float imageWidthInMeters) + /// image found or not + protected bool AddImageToLibrary(string fileName, string url, float imageWidthInMeters) { // check if image is in the library if (m_trackedImageInLibrary.Contains(fileName)) @@ -129,18 +169,55 @@ public class WorldAnalysisARFoundationModuleImage : WorldAnalysisARFoundationMod #endif bool found = CheckImageExist(ref imagePath); // try to find in jpg or png - if (!found) + if (!found && url.Length == 0) { Debug.LogWarning("Try to Track Image " + fileName + " but file not found"); return false; } - - //Load texture and add it to arfoundation library + + if (!found) + { + // Do not download the same image twice + if (!m_allDownloadedImages.Contains(url)) + { + // Here we don't check if url exists and still return true: could be improve + LoadTextureFromURL(url, fileName, imageWidthInMeters); + } + } + else + { + //Load texture and add it to arfoundation library + LoadTextureFromMemory(imagePath, fileName, imageWidthInMeters); + } + return true; + } + + /// + /// Add a new image from local memory to the arfoundation library + /// + /// local image path + /// file name + /// image width in meters + private void LoadTextureFromMemory(string imagePath, string fileName, float imageWidthInMeters) + { var rawData = File.ReadAllBytes(imagePath); Texture2D tex = new Texture2D(2, 2); tex.LoadImage(rawData); AddTextureToLibrary(tex, fileName, imageWidthInMeters); - return true; + } + + /// + /// Add a new image from a given url to the arfoundation library + /// + /// url to the image to download + /// file name + /// image width in meters + private async void LoadTextureFromURL(string url, string fileName, float imageWidthInMeters) + { + Debug.Log("Download image from url "+ url); + m_allDownloadedImages.Add(url); + KeyValuePair downloaded = await WorldAnalysisARFoundationHelper.DownloadFileHTTP(url); + LoadTextureFromMemory(downloaded.Key, fileName, imageWidthInMeters); } /// diff --git a/Runtime/Scripts/WorldAnalysisARFoundationModuleMesh.cs b/Runtime/Scripts/WorldAnalysisARFoundationModuleMesh.cs new file mode 100644 index 0000000000000000000000000000000000000000..81862ecda6f4ee3bae99521a2f52f1ab79442de0 --- /dev/null +++ b/Runtime/Scripts/WorldAnalysisARFoundationModuleMesh.cs @@ -0,0 +1,233 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.XR.ARFoundation; +using UnityEngine.XR.ARSubsystems; +using System.IO; +using Unity.XR.CoreUtils; +using static WorldAnalysisARFoundationModule; +using ETSI.ARF.OpenAPI.WorldStorage; + +public class WorldAnalysisARFoundationModuleMesh : WorldAnalysisARFoundationModule +{ + /// + /// ARFoundation Image tracking management + /// + private ARTrackedObjectManager m_trackedObjectManager; + /// + /// Name of all meshes that have been added to the library + /// + private List m_trackedMeshesInLibrary; + /// + /// Has downloaded asset bundle from an url + /// + private bool m_hasDownloadedBundle; + /// + /// List of tracked meshses with tracking infos + /// + private Dictionary m_trackedMeshes = new Dictionary(); + /// + /// Link between trackable name and uuid + /// + private Dictionary m_uuidToName = new Dictionary(); + /// + /// Bundle with all the XRReferenceObjectEntry + /// + private XRReferenceObjectEntry [] m_entries ; + + /// + /// Initialize image tracking module + /// + public void Initialize() + { + XROrigin origin = UnityEngine.Object.FindAnyObjectByType(); + m_trackedObjectManager = origin.gameObject.AddComponent(); + XRReferenceObjectLibrary library = (XRReferenceObjectLibrary) ScriptableObject.CreateInstance(typeof(XRReferenceObjectLibrary)); + m_trackedObjectManager.referenceLibrary = library ; + m_trackedMeshesInLibrary = new List(); + m_trackedObjectManager.trackedObjectPrefab = (GameObject)Resources.Load("ARFMeshTrackingPrefab"); + m_trackedObjectManager.trackedObjectsChanged += OnTrackedMeshesChanged; + m_trackedObjectManager.enabled = true ; // when instantiated without library : it is disabled + m_entries = null; + m_hasDownloadedBundle = false; + } + + /// + /// found + /// + /// name of the mesh trackable + public TrackableInfo GetPoseTrackable(Guid uuid) + { + if (m_uuidToName.ContainsKey(uuid)) + { + string name = m_uuidToName[uuid]; + if (m_trackedMeshes.ContainsKey(name)) + { + return m_trackedMeshes[name]; + } + } + return null; + } + + /// + /// Add a trackable : need to be an image + /// + /// Image trackable + /// Supported or not + public bool AddTrackable(Trackable trackable) + { + /// Here : we don't check if the trackable is allready added, AddMeshToLibrary does it + if (trackable.TrackableType != ETSI.ARF.OpenAPI.WorldStorage.TrackableType.MESH) + { + return false; + } + + // Check if an AssetBundle url is provided + string url = ""; + if (trackable.KeyvalueTags.ContainsKey("url")) + { + foreach (string s in trackable.KeyvalueTags["url"]) + { + // first one + url = s; + break; + } + } + + bool resul = AddMeshToLibrary(trackable.Name , url) ;// (float)trackable.TrackableSize[0]); + if (resul) + { + m_uuidToName[trackable.UUID] = trackable.Name; + } + return true; + } + + /// + /// Initialize capability object with Mesh tracking + /// + public ETSI.ARF.OpenAPI.WorldAnalysis.Capability GetSupportedCapability() + { + ETSI.ARF.OpenAPI.WorldAnalysis.Capability capabilityMesh = new ETSI.ARF.OpenAPI.WorldAnalysis.Capability(); + capabilityMesh.TrackableType = ETSI.ARF.OpenAPI.WorldAnalysis.TrackableType.MESH; + ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure encodingInformation = new ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure(); + encodingInformation.DataFormat = ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructureDataFormat.ARKIT; + encodingInformation.Version = "1.01"; + capabilityMesh.EncodingInformation = encodingInformation; + capabilityMesh.Framerate = 30; // Not particularly specified on ARKit + capabilityMesh.Latency = 0; // Not particularly specified on ARKit + capabilityMesh.Accuracy = 1; // Not particularly specified on ARKit + return capabilityMesh ; + } + + /// + /// Event manager for when a mesh is tracked + /// + /// the event + private void OnTrackedMeshesChanged(ARTrackedObjectsChangedEventArgs eventArgs) + { + foreach (var trackedMesh in eventArgs.updated) + { + Vector3 position = trackedMesh.transform.position; + Quaternion rotation = trackedMesh.transform.rotation; + + TrackableInfo info = new TrackableInfo(); + info.name = trackedMesh.referenceObject.name; + if (trackedMesh.trackingState == TrackingState.Tracking) + { + info.state = ETSI.ARF.OpenAPI.WorldAnalysis.PoseEstimationState.OK; + info.confidence = 100; + } + else if (trackedMesh.trackingState == TrackingState.Limited) + { + info.state = ETSI.ARF.OpenAPI.WorldAnalysis.PoseEstimationState.OK; + info.confidence = 50; + } + else + { + info.state = ETSI.ARF.OpenAPI.WorldAnalysis.PoseEstimationState.FAILURE; //ADD NOT_TRACKED ? + info.confidence = 0; + } + info.timeStamp = unchecked((int)DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()); + info.position = position; + info.rotation = rotation; + info.trackableType = ETSI.ARF.OpenAPI.WorldAnalysis.TrackableType.MESH; + m_trackedMeshes[info.name] = info; + } + } + + /// + /// Add a new mesh to the arfoundation library + /// + /// file name + /// + protected bool AddMeshToLibrary(string fileName, string url) + { + // check if mesh is in the library + if (m_trackedMeshesInLibrary.Contains(fileName)) + { + Debug.Log("Mesh allready added to library"); + return true; + } + + if (m_entries == null) + { + +#if UNITY_EDITOR + string bundlePath = Application.streamingAssetsPath + "/arfmeshes"; +#else + string bundlePath = Application.persistentDataPath + "/arfmeshes" ; +#endif + + if (url.Length > 0 && !m_hasDownloadedBundle) + { + KeyValuePair download = System.Threading.Tasks.Task.Run(() => WorldAnalysisARFoundationHelper.DownloadFileHTTP(url)).Result; // synchronous : not perfect at all prevent to add another mesh while bundle is downloading + bundlePath = download.Key; + m_hasDownloadedBundle = true; + } + + if (System.IO.File.Exists(bundlePath)) + { + AssetBundle bu = AssetBundle.LoadFromFile(bundlePath); + m_entries = bu.LoadAllAssets(); + } + else + { + return false; + } + } + + XRReferenceObjectEntry toAdd = null ; + foreach(XRReferenceObjectEntry entry in m_entries) + { + if (entry.name == fileName) + { + toAdd = entry ; + } + } + if (toAdd == null) + { + Debug.LogWarning("Try to Track Mesh " + fileName + " but XRReferenceObjectEntry not found in bundle"); + return false; + } + + AddARObjectEntryToLibrary(toAdd , fileName); + return true; + } + + /// + /// Add a Mesh + /// + private async void AddARObjectEntryToLibrary(XRReferenceObjectEntry arobject , string objectName) + { + while (ARSession.state == ARSessionState.CheckingAvailability || ARSession.state == ARSessionState.None) + { + await System.Threading.Tasks.Task.Delay(100); + } + + XRReferenceObject referenceObject = new XRReferenceObject(objectName); + referenceObject.AddEntry(arobject); + m_trackedObjectManager.referenceLibrary.Add(referenceObject); + + if (!m_trackedObjectManager.enabled) m_trackedObjectManager.enabled = true; // necessary because when object manger is instantiated without library it is disabled + } +} \ No newline at end of file diff --git a/Runtime/Scripts/WorldAnalysisARFoundationModuleMesh.cs.meta b/Runtime/Scripts/WorldAnalysisARFoundationModuleMesh.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..6b5b5db14b075698b923ff33aef50b98b0291fe9 --- /dev/null +++ b/Runtime/Scripts/WorldAnalysisARFoundationModuleMesh.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 19f8755167c0547cab884eab1fc44dc1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/etsi.isg.arf.worldanalysisarfoundation.asmdef b/Runtime/etsi.isg.arf.worldanalysisarfoundation.asmdef index 80bdd36751824aa6914254f8b4d4947580c2e0fa..6ce3bc4c2e55e76138827f1357e7a7755e35cc7a 100644 --- a/Runtime/etsi.isg.arf.worldanalysisarfoundation.asmdef +++ b/Runtime/etsi.isg.arf.worldanalysisarfoundation.asmdef @@ -6,7 +6,9 @@ "GUID:065e856e9f9becb49abdf0cb6855a039", "GUID:a9420e37d7990b54abdef6688edbe313", "GUID:92703082f92b41ba80f0d6912de66115", - "GUID:dc960734dc080426fa6612f1c5fe95f3" + "GUID:dc960734dc080426fa6612f1c5fe95f3", + "GUID:b35d8248e1a04478bb2d70fe76652ddf", + "GUID:dfd0ce20189d48e5b22bb4134b558f5a" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/package.json b/package.json index ff8e8c773f04d0041784dac220698e59703f81d8..57ef95e85ed246e7f0544a7c8927e47be95aa567 100644 --- a/package.json +++ b/package.json @@ -2,16 +2,15 @@ "author": "ETSI-ISG-ARF", "name": "etsi.isg.arf.worldanalysisarfoundation", "version": "0.0.1", - "displayName": "ISG-ARF World Analysis ARFoundation Wrapper Package ", + "displayName": "ISG-ARF World Analysis ARFoundation Wrapper Package", "description": "ARFoundation wrapper for the World Analysis of the Augmented Reality Framework", "unity": "2021.3", "dependencies": { - "etsi.isg.arf.worldstorage" : "0.0.2", - "etsi.isg.arf.worldanalysis" : "0.0.1", - "com.unity.xr.arfoundation": "5.1.3", - "com.unity.xr.arkit": "5.1.3", - "com.unity.xr.arcore": "5.1.3" - - }, + "etsi.isg.arf.worldstorage": "0.0.2", + "etsi.isg.arf.worldanalysis": "0.0.1", + "com.unity.xr.arfoundation": "5.1.3", + "com.unity.xr.arkit": "5.1.3", + "com.unity.xr.arcore": "5.1.3" + }, "keywords": [] } \ No newline at end of file