Todd Stinson
4 年前
当前提交
252ea895
共有 43 个文件被更改,包括 1763 次插入 和 96 次删除
-
1.gitignore
-
234Assets/Scenes/ARFoundationMenu/Menu.unity
-
10Assets/Scenes/CameraGrain/CameraGrain.shader
-
44Assets/Scenes/ImageTracking/Prefabs/FireFliesPrefab/Shaders/FireFly.shader
-
11Assets/Scenes/Meshing/Shaders/MeshingOverlay.shader
-
11Assets/Scenes/PlaneOcclusion/PlaneOcclusionShader.shader
-
5Assets/Scripts/UX/ARSceneSelectUI.cs
-
22Assets/Scripts/UX/CheckAvailableFeatures.cs
-
11Assets/Shaders/DepthGradient.shader
-
133Assets/Shaders/FeatheredPlaneShader.shader
-
11Assets/Shaders/HumanStencil.shader
-
11Assets/Shaders/Normal.shader
-
11Assets/Shaders/NormalOverlay.shader
-
15Packages/manifest.json
-
15ProjectSettings/EditorBuildSettings.asset
-
3ProjectSettings/ProjectSettings.asset
-
4ProjectSettings/ProjectVersion.txt
-
14README.md
-
3Assets/Scenes/ARKit/ARKitCoachingOverlay/ARKitCoachingOverlay.cs
-
95Assets/Scenes/ARKit/ARKitCoachingOverlay/ARKitCoachingOverlay.unity
-
8Assets/Scenes/ARKit.meta
-
409Packages/packages-lock.json
-
8Assets/Scenes/ARKit/ARKitGeoAnchors.meta
-
454Assets/Scenes/ARKit/ARKitGeoAnchors/ARKitGeoAnchors.unity
-
7Assets/Scenes/ARKit/ARKitGeoAnchors/ARKitGeoAnchors.unity.meta
-
153Assets/Scenes/ARKit/ARKitGeoAnchors/EnableGeoAnchors.cs
-
11Assets/Scenes/ARKit/ARKitGeoAnchors/EnableGeoAnchors.cs.meta
-
78Assets/Scenes/ARKit/ARKitGeoAnchors/GeoAnchorsNativeInterop.m
-
37Assets/Scenes/ARKit/ARKitGeoAnchors/GeoAnchorsNativeInterop.m.meta
-
19Assets/Scenes/ARKit/ARKitCoachingOverlay/CustomSessionDelegate.cs
-
11Assets/Scenes/ARKit/ARKitCoachingOverlay/CustomSessionDelegate.cs.meta
-
0/Assets/Scenes/ARKit/ARWorldMap.unity
-
0/Assets/Scenes/ARKit/ARWorldMap.unity.meta
-
0/Assets/Scenes/ARKit/ARCollaborationData.meta
-
0/Assets/Scenes/ARKit/ARKitCoachingOverlay.meta
-
0/Assets/Scenes/ARKit/ARKitCoachingOverlay
-
0/Assets/Scenes/ARKit/ARWorldMapSettings.lighting
-
0/Assets/Scenes/ARKit/ARWorldMapSettings.lighting.meta
-
0/Assets/Scenes/ARKit/ThermalState.meta
-
0/Assets/Scenes/ARKit/ThermalState
-
0/Assets/Scenes/ARKit/ARCollaborationData
|
|||
Shader "Unlit/FeatheredPlaneShader" |
|||
{ |
|||
Properties |
|||
{ |
|||
_MainTex ("Texture", 2D) = "white" {} |
|||
_TexTintColor("Texture Tint Color", Color) = (1,1,1,1) |
|||
_PlaneColor("Plane Color", Color) = (1,1,1,1) |
|||
} |
|||
SubShader |
|||
{ |
|||
Tags { "RenderType"="Transparent" "Queue"="Transparent" } |
|||
LOD 100 |
|||
Blend SrcAlpha OneMinusSrcAlpha |
|||
ZWrite Off |
|||
Properties |
|||
{ |
|||
_MainTex ("Texture", 2D) = "white" {} |
|||
_TexTintColor("Texture Tint Color", Color) = (1,1,1,1) |
|||
_PlaneColor("Plane Color", Color) = (1,1,1,1) |
|||
} |
|||
SubShader |
|||
{ |
|||
Tags { "RenderType"="Transparent" "Queue"="Transparent" } |
|||
LOD 100 |
|||
Blend SrcAlpha OneMinusSrcAlpha |
|||
ZWrite Off |
|||
|
|||
Pass |
|||
{ |
|||
CGPROGRAM |
|||
#pragma vertex vert |
|||
#pragma fragment frag |
|||
|
|||
#include "UnityCG.cginc" |
|||
|
|||
struct appdata |
|||
{ |
|||
float4 vertex : POSITION; |
|||
float2 uv : TEXCOORD0; |
|||
float3 uv2 : TEXCOORD1; |
|||
|
|||
UNITY_VERTEX_INPUT_INSTANCE_ID |
|||
}; |
|||
|
|||
struct v2f |
|||
{ |
|||
float4 vertex : SV_POSITION; |
|||
float2 uv : TEXCOORD0; |
|||
float3 uv2 : TEXCOORD1; |
|||
|
|||
UNITY_VERTEX_OUTPUT_STEREO |
|||
}; |
|||
|
|||
sampler2D _MainTex; |
|||
float4 _MainTex_ST; |
|||
fixed4 _TexTintColor; |
|||
fixed4 _PlaneColor; |
|||
float _ShortestUVMapping; |
|||
Pass |
|||
{ |
|||
CGPROGRAM |
|||
#pragma vertex vert |
|||
#pragma fragment frag |
|||
|
|||
#include "UnityCG.cginc" |
|||
v2f vert (appdata v) |
|||
{ |
|||
v2f o; |
|||
struct appdata |
|||
{ |
|||
float4 vertex : POSITION; |
|||
float2 uv : TEXCOORD0; |
|||
float3 uv2 : TEXCOORD1; |
|||
}; |
|||
UNITY_SETUP_INSTANCE_ID(v); |
|||
UNITY_INITIALIZE_OUTPUT(v2f, o); |
|||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); |
|||
struct v2f |
|||
{ |
|||
float4 vertex : SV_POSITION; |
|||
float2 uv : TEXCOORD0; |
|||
float3 uv2 : TEXCOORD1; |
|||
}; |
|||
o.vertex = UnityObjectToClipPos(v.vertex); |
|||
o.uv = TRANSFORM_TEX(v.uv, _MainTex); |
|||
o.uv2 = v.uv2; |
|||
return o; |
|||
} |
|||
sampler2D _MainTex; |
|||
float4 _MainTex_ST; |
|||
fixed4 _TexTintColor; |
|||
fixed4 _PlaneColor; |
|||
float _ShortestUVMapping; |
|||
fixed4 frag (v2f i) : SV_Target |
|||
{ |
|||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); |
|||
v2f vert (appdata v) |
|||
{ |
|||
v2f o; |
|||
o.vertex = UnityObjectToClipPos(v.vertex); |
|||
o.uv = TRANSFORM_TEX(v.uv, _MainTex); |
|||
o.uv2 = v.uv2; |
|||
return o; |
|||
} |
|||
|
|||
fixed4 frag (v2f i) : SV_Target |
|||
{ |
|||
fixed4 col = tex2D(_MainTex, i.uv) * _TexTintColor; |
|||
col = lerp( _PlaneColor, col, col.a); |
|||
// Fade out from as we pass the edge. |
|||
// uv2.x stores a mapped UV that will be "1" at the beginning of the feathering. |
|||
// We fade until we reach at the edge of the shortest UV mapping. |
|||
// This is the remmaped UV value at the vertex. |
|||
// We choose the shorted one so that ll edges will fade out completely. |
|||
// See ARFeatheredPlaneMeshVisualizer.cs for more details. |
|||
col.a *= 1-smoothstep(1, _ShortestUVMapping, i.uv2.x); |
|||
return col; |
|||
} |
|||
ENDCG |
|||
} |
|||
} |
|||
fixed4 col = tex2D(_MainTex, i.uv) * _TexTintColor; |
|||
col = lerp( _PlaneColor, col, col.a); |
|||
// Fade out from as we pass the edge. |
|||
// uv2.x stores a mapped UV that will be "1" at the beginning of the feathering. |
|||
// We fade until we reach at the edge of the shortest UV mapping. |
|||
// This is the remmaped UV value at the vertex. |
|||
// We choose the shorted one so that ll edges will fade out completely. |
|||
// See ARFeatheredPlaneMeshVisualizer.cs for more details. |
|||
col.a *= 1-smoothstep(1, _ShortestUVMapping, i.uv2.x); |
|||
return col; |
|||
} |
|||
ENDCG |
|||
} |
|||
} |
|||
} |
|
|||
m_EditorVersion: 2020.1.10f1 |
|||
m_EditorVersionWithRevision: 2020.1.10f1 (974a9d56f159) |
|||
m_EditorVersion: 2020.1.11f1 |
|||
m_EditorVersionWithRevision: 2020.1.11f1 (698c1113cef0) |
|
|||
fileFormatVersion: 2 |
|||
guid: 2e0dd4061c8b44f6685dbb181356cb71 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
{ |
|||
"dependencies": { |
|||
"com.unity.editorcoroutines": { |
|||
"version": "1.0.0", |
|||
"depth": 1, |
|||
"source": "registry", |
|||
"dependencies": {}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.ext.nunit": { |
|||
"version": "1.0.0", |
|||
"depth": 2, |
|||
"source": "registry", |
|||
"dependencies": {}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.ide.rider": { |
|||
"version": "1.2.1", |
|||
"depth": 0, |
|||
"source": "registry", |
|||
"dependencies": { |
|||
"com.unity.test-framework": "1.1.1" |
|||
}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.ide.visualstudio": { |
|||
"version": "2.0.3", |
|||
"depth": 0, |
|||
"source": "registry", |
|||
"dependencies": {}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.ide.vscode": { |
|||
"version": "1.2.3", |
|||
"depth": 0, |
|||
"source": "registry", |
|||
"dependencies": {}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.inputsystem": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "registry", |
|||
"dependencies": {}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.subsystemregistration": { |
|||
"version": "1.1.0", |
|||
"depth": 2, |
|||
"source": "registry", |
|||
"dependencies": { |
|||
"com.unity.modules.subsystems": "1.0.0" |
|||
}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.test-framework": { |
|||
"version": "1.1.18", |
|||
"depth": 1, |
|||
"source": "registry", |
|||
"dependencies": { |
|||
"com.unity.ext.nunit": "1.0.0", |
|||
"com.unity.modules.imgui": "1.0.0", |
|||
"com.unity.modules.jsonserialize": "1.0.0" |
|||
}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.ugui": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.ui": "1.0.0", |
|||
"com.unity.modules.imgui": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.xr.arcore": { |
|||
"version": "4.1.0-preview.12", |
|||
"depth": 0, |
|||
"source": "registry", |
|||
"dependencies": { |
|||
"com.unity.xr.arsubsystems": "4.1.0-preview.12", |
|||
"com.unity.xr.management": "3.2.16", |
|||
"com.unity.modules.androidjni": "1.0.0" |
|||
}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.xr.arfoundation": { |
|||
"version": "4.1.0-preview.12", |
|||
"depth": 0, |
|||
"source": "registry", |
|||
"dependencies": { |
|||
"com.unity.xr.arsubsystems": "4.1.0-preview.12", |
|||
"com.unity.xr.management": "3.2.16" |
|||
}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.xr.arkit": { |
|||
"version": "4.1.0-preview.12", |
|||
"depth": 0, |
|||
"source": "registry", |
|||
"dependencies": { |
|||
"com.unity.editorcoroutines": "1.0.0", |
|||
"com.unity.xr.arsubsystems": "4.1.0-preview.12", |
|||
"com.unity.xr.management": "3.2.16" |
|||
}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.xr.arkit-face-tracking": { |
|||
"version": "4.1.0-preview.12", |
|||
"depth": 0, |
|||
"source": "registry", |
|||
"dependencies": { |
|||
"com.unity.xr.arkit": "4.1.0-preview.12", |
|||
"com.unity.xr.arsubsystems": "4.1.0-preview.12" |
|||
}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.xr.arsubsystems": { |
|||
"version": "4.1.0-preview.12", |
|||
"depth": 1, |
|||
"source": "registry", |
|||
"dependencies": { |
|||
"com.unity.subsystemregistration": "1.1.0" |
|||
}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.xr.interaction.toolkit": { |
|||
"version": "0.9.4-preview", |
|||
"depth": 0, |
|||
"source": "registry", |
|||
"dependencies": { |
|||
"com.unity.ugui": "1.0.0", |
|||
"com.unity.xr.legacyinputhelpers": "1.3.11" |
|||
}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.xr.legacyinputhelpers": { |
|||
"version": "2.1.4", |
|||
"depth": 1, |
|||
"source": "registry", |
|||
"dependencies": {}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.xr.management": { |
|||
"version": "3.2.16", |
|||
"depth": 1, |
|||
"source": "registry", |
|||
"dependencies": { |
|||
"com.unity.xr.legacyinputhelpers": "2.1.2", |
|||
"com.unity.subsystemregistration": "1.0.6" |
|||
}, |
|||
"url": "https://packages.unity.com" |
|||
}, |
|||
"com.unity.modules.ai": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.androidjni": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.animation": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.assetbundle": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.audio": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.cloth": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.physics": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.director": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.audio": "1.0.0", |
|||
"com.unity.modules.animation": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.imageconversion": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.imgui": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.jsonserialize": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.particlesystem": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.physics": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.physics2d": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.screencapture": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.imageconversion": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.subsystems": { |
|||
"version": "1.0.0", |
|||
"depth": 1, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.jsonserialize": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.terrain": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.terrainphysics": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.physics": "1.0.0", |
|||
"com.unity.modules.terrain": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.tilemap": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.physics2d": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.ui": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.uielements": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.ui": "1.0.0", |
|||
"com.unity.modules.imgui": "1.0.0", |
|||
"com.unity.modules.jsonserialize": "1.0.0", |
|||
"com.unity.modules.uielementsnative": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.uielementsnative": { |
|||
"version": "1.0.0", |
|||
"depth": 1, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.ui": "1.0.0", |
|||
"com.unity.modules.imgui": "1.0.0", |
|||
"com.unity.modules.jsonserialize": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.umbra": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.unityanalytics": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.unitywebrequest": "1.0.0", |
|||
"com.unity.modules.jsonserialize": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.unitywebrequest": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.unitywebrequestassetbundle": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.assetbundle": "1.0.0", |
|||
"com.unity.modules.unitywebrequest": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.unitywebrequestaudio": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.unitywebrequest": "1.0.0", |
|||
"com.unity.modules.audio": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.unitywebrequesttexture": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.unitywebrequest": "1.0.0", |
|||
"com.unity.modules.imageconversion": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.unitywebrequestwww": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.unitywebrequest": "1.0.0", |
|||
"com.unity.modules.unitywebrequestassetbundle": "1.0.0", |
|||
"com.unity.modules.unitywebrequestaudio": "1.0.0", |
|||
"com.unity.modules.audio": "1.0.0", |
|||
"com.unity.modules.assetbundle": "1.0.0", |
|||
"com.unity.modules.imageconversion": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.vehicles": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.physics": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.video": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.audio": "1.0.0", |
|||
"com.unity.modules.ui": "1.0.0", |
|||
"com.unity.modules.unitywebrequest": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.vr": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.jsonserialize": "1.0.0", |
|||
"com.unity.modules.physics": "1.0.0", |
|||
"com.unity.modules.xr": "1.0.0" |
|||
} |
|||
}, |
|||
"com.unity.modules.wind": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": {} |
|||
}, |
|||
"com.unity.modules.xr": { |
|||
"version": "1.0.0", |
|||
"depth": 0, |
|||
"source": "builtin", |
|||
"dependencies": { |
|||
"com.unity.modules.physics": "1.0.0", |
|||
"com.unity.modules.jsonserialize": "1.0.0", |
|||
"com.unity.modules.subsystems": "1.0.0" |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e6deb90c0c9ab4a1c8a0e761b3e0b790 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!29 &1 |
|||
OcclusionCullingSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 2 |
|||
m_OcclusionBakeSettings: |
|||
smallestOccluder: 5 |
|||
smallestHole: 0.25 |
|||
backfaceThreshold: 100 |
|||
m_SceneGUID: 00000000000000000000000000000000 |
|||
m_OcclusionCullingData: {fileID: 0} |
|||
--- !u!104 &2 |
|||
RenderSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 9 |
|||
m_Fog: 0 |
|||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
|||
m_FogMode: 3 |
|||
m_FogDensity: 0.01 |
|||
m_LinearFogStart: 0 |
|||
m_LinearFogEnd: 300 |
|||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} |
|||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} |
|||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} |
|||
m_AmbientIntensity: 1 |
|||
m_AmbientMode: 0 |
|||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
|||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_HaloStrength: 0.5 |
|||
m_FlareStrength: 1 |
|||
m_FlareFadeSpeed: 3 |
|||
m_HaloTexture: {fileID: 0} |
|||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
|||
m_DefaultReflectionMode: 0 |
|||
m_DefaultReflectionResolution: 128 |
|||
m_ReflectionBounces: 1 |
|||
m_ReflectionIntensity: 1 |
|||
m_CustomReflection: {fileID: 0} |
|||
m_Sun: {fileID: 0} |
|||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
|||
m_UseRadianceAmbientProbe: 0 |
|||
--- !u!157 &3 |
|||
LightmapSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 12 |
|||
m_GIWorkflowMode: 1 |
|||
m_GISettings: |
|||
serializedVersion: 2 |
|||
m_BounceScale: 1 |
|||
m_IndirectOutputScale: 1 |
|||
m_AlbedoBoost: 1 |
|||
m_EnvironmentLightingMode: 0 |
|||
m_EnableBakedLightmaps: 1 |
|||
m_EnableRealtimeLightmaps: 0 |
|||
m_LightmapEditorSettings: |
|||
serializedVersion: 12 |
|||
m_Resolution: 2 |
|||
m_BakeResolution: 40 |
|||
m_AtlasSize: 1024 |
|||
m_AO: 0 |
|||
m_AOMaxDistance: 1 |
|||
m_CompAOExponent: 1 |
|||
m_CompAOExponentDirect: 0 |
|||
m_ExtractAmbientOcclusion: 0 |
|||
m_Padding: 2 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_LightmapsBakeMode: 1 |
|||
m_TextureCompression: 1 |
|||
m_FinalGather: 0 |
|||
m_FinalGatherFiltering: 1 |
|||
m_FinalGatherRayCount: 256 |
|||
m_ReflectionCompression: 2 |
|||
m_MixedBakeMode: 2 |
|||
m_BakeBackend: 1 |
|||
m_PVRSampling: 1 |
|||
m_PVRDirectSampleCount: 32 |
|||
m_PVRSampleCount: 512 |
|||
m_PVRBounces: 2 |
|||
m_PVREnvironmentSampleCount: 256 |
|||
m_PVREnvironmentReferencePointCount: 2048 |
|||
m_PVRFilteringMode: 1 |
|||
m_PVRDenoiserTypeDirect: 1 |
|||
m_PVRDenoiserTypeIndirect: 1 |
|||
m_PVRDenoiserTypeAO: 1 |
|||
m_PVRFilterTypeDirect: 0 |
|||
m_PVRFilterTypeIndirect: 0 |
|||
m_PVRFilterTypeAO: 0 |
|||
m_PVREnvironmentMIS: 1 |
|||
m_PVRCulling: 1 |
|||
m_PVRFilteringGaussRadiusDirect: 1 |
|||
m_PVRFilteringGaussRadiusIndirect: 5 |
|||
m_PVRFilteringGaussRadiusAO: 2 |
|||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
|||
m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
|||
m_PVRFilteringAtrousPositionSigmaAO: 1 |
|||
m_ExportTrainingData: 0 |
|||
m_TrainingDataDestination: TrainingData |
|||
m_LightProbeSampleCountMultiplier: 4 |
|||
m_LightingDataAsset: {fileID: 0} |
|||
m_LightingSettings: {fileID: 0} |
|||
--- !u!196 &4 |
|||
NavMeshSettings: |
|||
serializedVersion: 2 |
|||
m_ObjectHideFlags: 0 |
|||
m_BuildSettings: |
|||
serializedVersion: 2 |
|||
agentTypeID: 0 |
|||
agentRadius: 0.5 |
|||
agentHeight: 2 |
|||
agentSlope: 45 |
|||
agentClimb: 0.4 |
|||
ledgeDropHeight: 0 |
|||
maxJumpAcrossDistance: 0 |
|||
minRegionArea: 2 |
|||
manualCellSize: 0 |
|||
cellSize: 0.16666667 |
|||
manualTileSize: 0 |
|||
tileSize: 256 |
|||
accuratePlacement: 0 |
|||
maxJobWorkers: 0 |
|||
preserveTilesOutsideBounds: 0 |
|||
debug: |
|||
m_Flags: 0 |
|||
m_NavMeshData: {fileID: 0} |
|||
--- !u!1 &277780414 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 277780416} |
|||
- component: {fileID: 277780415} |
|||
m_Layer: 0 |
|||
m_Name: AR Session Origin |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!114 &277780415 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 277780414} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 520bb47c46cf8624fafb307b7d1b862a, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Camera: {fileID: 1198095226} |
|||
--- !u!4 &277780416 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 277780414} |
|||
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_Children: |
|||
- {fileID: 1198095230} |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 1 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &793213725 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 793213728} |
|||
- component: {fileID: 793213727} |
|||
- component: {fileID: 793213726} |
|||
- component: {fileID: 793213729} |
|||
m_Layer: 0 |
|||
m_Name: AR Session |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!114 &793213726 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 793213725} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: fa850fbd5b8aded44846f96e35f1a9f5, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
--- !u!114 &793213727 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 793213725} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 3859a92a05d4f5d418cb6ca605290e74, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_AttemptUpdate: 1 |
|||
m_MatchFrameRate: 1 |
|||
m_TrackingMode: 2 |
|||
--- !u!4 &793213728 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 793213725} |
|||
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_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 2 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!114 &793213729 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 793213725} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 83ef5ba9cc0da4a19a969308a48e993d, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
--- !u!1 &1198095225 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1198095230} |
|||
- component: {fileID: 1198095226} |
|||
- component: {fileID: 1198095229} |
|||
- component: {fileID: 1198095228} |
|||
- component: {fileID: 1198095227} |
|||
m_Layer: 0 |
|||
m_Name: AR Camera |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!20 &1198095226 |
|||
Camera: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1198095225} |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_ClearFlags: 2 |
|||
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 1} |
|||
m_projectionMatrixMode: 1 |
|||
m_GateFitMode: 2 |
|||
m_FOVAxisMode: 0 |
|||
m_SensorSize: {x: 36, y: 24} |
|||
m_LensShift: {x: 0, y: 0} |
|||
m_FocalLength: 50 |
|||
m_NormalizedViewPortRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
near clip plane: 0.1 |
|||
far clip plane: 20 |
|||
field of view: 60 |
|||
orthographic: 0 |
|||
orthographic size: 5 |
|||
m_Depth: 0 |
|||
m_CullingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
m_RenderingPath: -1 |
|||
m_TargetTexture: {fileID: 0} |
|||
m_TargetDisplay: 0 |
|||
m_TargetEye: 3 |
|||
m_HDR: 1 |
|||
m_AllowMSAA: 1 |
|||
m_AllowDynamicResolution: 0 |
|||
m_ForceIntoRT: 0 |
|||
m_OcclusionCulling: 1 |
|||
m_StereoConvergence: 10 |
|||
m_StereoSeparation: 0.022 |
|||
--- !u!114 &1198095227 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1198095225} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 816b289ef451e094f9ae174fb4cf8db0, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_UseCustomMaterial: 0 |
|||
m_CustomMaterial: {fileID: 0} |
|||
--- !u!114 &1198095228 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1198095225} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 4966719baa26e4b0e8231a24d9bd491a, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_FocusMode: -1 |
|||
m_LightEstimationMode: -1 |
|||
m_AutoFocus: 1 |
|||
m_LightEstimation: 0 |
|||
m_FacingDirection: 1 |
|||
--- !u!114 &1198095229 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1198095225} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 6e3c44306fb1e439a9f18b2212b8ab70, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
--- !u!4 &1198095230 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1198095225} |
|||
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_Children: [] |
|||
m_Father: {fileID: 277780416} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &1494310549 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1494310551} |
|||
- component: {fileID: 1494310550} |
|||
m_Layer: 0 |
|||
m_Name: Directional Light |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!108 &1494310550 |
|||
Light: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1494310549} |
|||
m_Enabled: 1 |
|||
serializedVersion: 10 |
|||
m_Type: 1 |
|||
m_Shape: 0 |
|||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} |
|||
m_Intensity: 1 |
|||
m_Range: 10 |
|||
m_SpotAngle: 30 |
|||
m_InnerSpotAngle: 21.80208 |
|||
m_CookieSize: 10 |
|||
m_Shadows: |
|||
m_Type: 2 |
|||
m_Resolution: -1 |
|||
m_CustomResolution: -1 |
|||
m_Strength: 1 |
|||
m_Bias: 0.05 |
|||
m_NormalBias: 0.4 |
|||
m_NearPlane: 0.2 |
|||
m_CullingMatrixOverride: |
|||
e00: 1 |
|||
e01: 0 |
|||
e02: 0 |
|||
e03: 0 |
|||
e10: 0 |
|||
e11: 1 |
|||
e12: 0 |
|||
e13: 0 |
|||
e20: 0 |
|||
e21: 0 |
|||
e22: 1 |
|||
e23: 0 |
|||
e30: 0 |
|||
e31: 0 |
|||
e32: 0 |
|||
e33: 1 |
|||
m_UseCullingMatrixOverride: 0 |
|||
m_Cookie: {fileID: 0} |
|||
m_DrawHalo: 0 |
|||
m_Flare: {fileID: 0} |
|||
m_RenderMode: 0 |
|||
m_CullingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
m_RenderingLayerMask: 1 |
|||
m_Lightmapping: 4 |
|||
m_LightShadowCasterMode: 0 |
|||
m_AreaSize: {x: 1, y: 1} |
|||
m_BounceIntensity: 1 |
|||
m_ColorTemperature: 6570 |
|||
m_UseColorTemperature: 0 |
|||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} |
|||
m_UseBoundingSphereOverride: 0 |
|||
m_ShadowRadius: 0 |
|||
m_ShadowAngle: 0 |
|||
--- !u!4 &1494310551 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1494310549} |
|||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} |
|||
m_LocalPosition: {x: 0, y: 3, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: 338f0f26e48a9442c8562245d8bae9ab |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using Unity.Collections; |
|||
using UnityEngine; |
|||
using UnityEngine.XR.ARFoundation; |
|||
using UnityEngine.XR.ARSubsystems; |
|||
|
|||
#if UNITY_IOS
|
|||
using System.Runtime.InteropServices; |
|||
using UnityEngine.XR.ARKit; |
|||
|
|||
// This custom ConfigurationChooser tells the ARKit XR Plugin to use an ARGeoTrackingConfiguration
|
|||
// See https://developer.apple.com/documentation/arkit/argeotrackingconfiguration?language=objc
|
|||
class ARGeoAnchorConfigurationChooser : ConfigurationChooser |
|||
{ |
|||
static readonly ConfigurationChooser s_DefaultChooser = new DefaultConfigurationChooser(); |
|||
|
|||
static readonly ConfigurationDescriptor s_ARGeoConfigurationDescriptor = new ConfigurationDescriptor( |
|||
// On iOS, the "identifier" used by the ConfigurationDescriptor is the Objective-C metaclass for the type
|
|||
// of configuration that should be used. In general, you should not create new ConfigurationDescriptors
|
|||
// (you should pick one of the descriptors passed into ChooseConfiguration); however, this will do for this
|
|||
// specific case.
|
|||
ARGeoTrackingConfigurationClass, |
|||
|
|||
// These are the "features" supported by the ARGeoTrackingConfiguration
|
|||
Feature.WorldFacingCamera | |
|||
Feature.PositionAndRotation | |
|||
Feature.ImageTracking | |
|||
Feature.PlaneTracking | |
|||
Feature.ObjectTracking | |
|||
Feature.EnvironmentProbes, |
|||
|
|||
// Rank is meant to be used as a tie breaker in our implementation of ChooseConfiguration, but since we will
|
|||
// always choose this descriptor, it doesn't matter what value we use here.
|
|||
0); |
|||
|
|||
public override Configuration ChooseConfiguration(NativeSlice<ConfigurationDescriptor> descriptors, Feature requestedFeatures) |
|||
{ |
|||
// If location services are running, then we can request an ARGeoTrackingConfiguration by its class pointer
|
|||
return Input.location.status == LocationServiceStatus.Running |
|||
? new Configuration(s_ARGeoConfigurationDescriptor, requestedFeatures.Intersection(s_ARGeoConfigurationDescriptor.capabilities)) |
|||
: s_DefaultChooser.ChooseConfiguration(descriptors, requestedFeatures); |
|||
} |
|||
|
|||
public static extern IntPtr ARGeoTrackingConfigurationClass |
|||
{ |
|||
[DllImport("__Internal", EntryPoint = "ARGeoTrackingConfiguration_class")] |
|||
get; |
|||
} |
|||
} |
|||
#endif
|
|||
|
|||
[RequireComponent(typeof(ARSession))] |
|||
public class EnableGeoAnchors : MonoBehaviour |
|||
{ |
|||
#if UNITY_IOS// && !UNITY_EDITOR
|
|||
|
|||
// See https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@4.0/manual/extensions.html
|
|||
public struct NativePtrData |
|||
{ |
|||
public int version; |
|||
public IntPtr sessionPtr; |
|||
} |
|||
|
|||
// See https://developer.apple.com/documentation/corelocation/cllocationcoordinate2d?language=objc
|
|||
public struct CLLocationCoordinate2D |
|||
{ |
|||
public double latitude; |
|||
public double longitude; |
|||
} |
|||
|
|||
// ARGeoAnchors requires location services
|
|||
void Start() => Input.location.Start(); |
|||
|
|||
void OnGUI() |
|||
{ |
|||
GUI.skin.label.fontSize = 50; |
|||
GUILayout.Space(100); |
|||
|
|||
if (ARGeoAnchorConfigurationChooser.ARGeoTrackingConfigurationClass == IntPtr.Zero) |
|||
{ |
|||
GUILayout.Label("ARGeoTrackingConfiguration is not supported on this device."); |
|||
return; |
|||
} |
|||
|
|||
switch (Input.location.status) |
|||
{ |
|||
case LocationServiceStatus.Initializing: |
|||
GUILayout.Label("Waiting for location services..."); |
|||
break; |
|||
case LocationServiceStatus.Stopped: |
|||
GUILayout.Label("Location services stopped. Unable to use geo anchors."); |
|||
break; |
|||
case LocationServiceStatus.Failed: |
|||
GUILayout.Label("Location services failed. Unable to use geo anchors."); |
|||
break; |
|||
case LocationServiceStatus.Running: |
|||
GUILayout.Label("Tap screen to add a geo anchor."); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
void Update() |
|||
{ |
|||
// Can't do anything interesting until location services are running.
|
|||
if (Input.location.status != LocationServiceStatus.Running) |
|||
return; |
|||
|
|||
if (GetComponent<ARSession>().subsystem is ARKitSessionSubsystem subsystem) |
|||
{ |
|||
if (!(subsystem.configurationChooser is ARGeoAnchorConfigurationChooser)) |
|||
{ |
|||
// Replace the config chooser with our own
|
|||
subsystem.configurationChooser = new ARGeoAnchorConfigurationChooser(); |
|||
} |
|||
|
|||
// We don't have to do this, but it will silence a warning message in Xcode
|
|||
// since the ARGeoTrackingConfiguration can only use the GravityAndHeading value.
|
|||
subsystem.requestedWorldAlignment = ARWorldAlignment.GravityAndHeading; |
|||
|
|||
// Make sure we have a native ptr
|
|||
if (subsystem.nativePtr == IntPtr.Zero) |
|||
return; |
|||
|
|||
// Get the session ptr from the native ptr data
|
|||
var session = Marshal.PtrToStructure<NativePtrData>(subsystem.nativePtr).sessionPtr; |
|||
if (session == IntPtr.Zero) |
|||
return; |
|||
|
|||
var screenTapped = Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended; |
|||
if (screenTapped) |
|||
{ |
|||
// Get last known location data
|
|||
var locationData = Input.location.lastData; |
|||
|
|||
// Add a geo anchor. See GeoAnchorsNativeInterop.m to see how this works.
|
|||
AddGeoAnchor(session, new CLLocationCoordinate2D |
|||
{ |
|||
latitude = locationData.latitude, |
|||
longitude = locationData.longitude |
|||
}, locationData.altitude); |
|||
} |
|||
|
|||
DoSomethingWithSession(session); |
|||
} |
|||
} |
|||
|
|||
[DllImport("__Internal")] |
|||
static extern void DoSomethingWithSession(IntPtr session); |
|||
|
|||
[DllImport("__Internal", EntryPoint = "ARSession_addGeoAnchor")] |
|||
static extern void AddGeoAnchor(IntPtr session, CLLocationCoordinate2D coordinate, double altitude); |
|||
#endif
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 83ef5ba9cc0da4a19a969308a48e993d |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#import <ARKit/ARKit.h> |
|||
|
|||
// Gets the Objective-C metaclass for ARGeoTrackingConfiguration |
|||
Class ARGeoTrackingConfiguration_class() { |
|||
// ARGeoTrackingConfiguration requires iOS 14 |
|||
if (@available(iOS 14, *)) { |
|||
if (ARGeoTrackingConfiguration.isSupported) { |
|||
return [ARGeoTrackingConfiguration class]; |
|||
} else { |
|||
NSLog(@"ARGeoTrackingConfiguration is not supported on this device."); |
|||
} |
|||
} |
|||
return NULL; |
|||
} |
|||
|
|||
// Adds an ARGeoAnchor to the ARSession |
|||
void ARSession_addGeoAnchor(void* self, CLLocationCoordinate2D coordinate, double altitude) { |
|||
if (@available(iOS 14, *)) { |
|||
// Cast the void* back to an ARSession |
|||
ARSession* session = (__bridge ARSession*)self; |
|||
|
|||
// Create a new ARGeoAnchor |
|||
// See https://developer.apple.com/documentation/arkit/argeoanchor/3551719-initwithcoordinate?language=objc |
|||
ARGeoAnchor* geoAnchor = [[ARGeoAnchor alloc] initWithCoordinate:coordinate altitude:altitude]; |
|||
|
|||
// Add the new anchor to the session |
|||
[session addAnchor:geoAnchor]; |
|||
|
|||
NSLog(@"Added ARGeoAnchor at (%f, %f) at %f meters", coordinate.latitude, coordinate.longitude, altitude); |
|||
} |
|||
} |
|||
|
|||
// Flips a transform from ARKit's right-handed coordinate system to Unity's left-handed coordinate system. |
|||
static inline simd_float4x4 FlipHandedness(simd_float4x4 transform) { |
|||
const simd_float4* c = transform.columns; |
|||
return simd_matrix(simd_make_float4( c[0].xy, -c[0].z, c[0].w), |
|||
simd_make_float4( c[1].xy, -c[1].z, c[1].w), |
|||
simd_make_float4(-c[2].xy, c[2].z, c[2].w), |
|||
simd_make_float4( c[3].xy, -c[3].z, c[3].w)); |
|||
} |
|||
|
|||
// Demonstrates "doing something" with the ARSession |
|||
void DoSomethingWithSession(void* sessionPtr) { |
|||
|
|||
// =============================== |
|||
// Replace this with your own code |
|||
// =============================== |
|||
|
|||
// In this example, just look for all ARGeoAnchors and print out their transforms. |
|||
if (@available(iOS 14, *)) { |
|||
ARSession* session = (__bridge ARSession*)sessionPtr; |
|||
|
|||
for (ARAnchor* anchor in session.currentFrame.anchors) { |
|||
if ([anchor isKindOfClass:[ARGeoAnchor class]]) { |
|||
ARGeoAnchor* geoAnchor = (ARGeoAnchor*)anchor; |
|||
const simd_float4x4 transform = FlipHandedness(geoAnchor.transform); |
|||
const simd_float4* c = transform.columns; |
|||
NSLog(@"ARGeoAnchor %@ transform:\n" |
|||
"[%+f %+f %+f %+f]\n" |
|||
"[%+f %+f %+f %+f]\n" |
|||
"[%+f %+f %+f %+f]\n" |
|||
"[%+f %+f %+f %+f]\n", |
|||
[geoAnchor.identifier UUIDString], |
|||
c[0].x, c[1].x, c[2].x, c[3].x, |
|||
c[0].y, c[1].y, c[2].y, c[3].y, |
|||
c[0].z, c[1].z, c[2].z, c[3].z, |
|||
c[0].w, c[1].w, c[2].w, c[3].w); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
bool ARFoundationSamples_IsiOS14OrLater() { |
|||
if (@available(iOS 14, *)) { |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f2965133628254dfea0af639813eae59 |
|||
PluginImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
iconMap: {} |
|||
executionOrder: {} |
|||
defineConstraints: [] |
|||
isPreloaded: 0 |
|||
isOverridable: 0 |
|||
isExplicitlyReferenced: 0 |
|||
validateReferences: 1 |
|||
platformData: |
|||
- first: |
|||
Any: |
|||
second: |
|||
enabled: 0 |
|||
settings: {} |
|||
- first: |
|||
Editor: Editor |
|||
second: |
|||
enabled: 0 |
|||
settings: |
|||
DefaultValueInitialized: true |
|||
- first: |
|||
iPhone: iOS |
|||
second: |
|||
enabled: 1 |
|||
settings: {} |
|||
- first: |
|||
tvOS: tvOS |
|||
second: |
|||
enabled: 1 |
|||
settings: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#if UNITY_IOS
|
|||
using UnityEngine.XR.ARKit; |
|||
|
|||
namespace UnityEngine.XR.ARFoundation.Samples |
|||
{ |
|||
public class CustomSessionDelegate : DefaultARKitSessionDelegate |
|||
{ |
|||
protected override void OnCoachingOverlayViewWillActivate(ARKitSessionSubsystem sessionSubsystem) |
|||
{ |
|||
Logger.Log(nameof(OnCoachingOverlayViewWillActivate)); |
|||
} |
|||
|
|||
protected override void OnCoachingOverlayViewDidDeactivate(ARKitSessionSubsystem sessionSubsystem) |
|||
{ |
|||
Logger.Log(nameof(OnCoachingOverlayViewDidDeactivate)); |
|||
} |
|||
} |
|||
} |
|||
#endif
|
|
|||
fileFormatVersion: 2 |
|||
guid: cad7396bd91de4031b8bd2c456f68941 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue