diff --git a/Assets/Prefabs/AR Default Plane.prefab b/Assets/Prefabs/AR Default Plane.prefab new file mode 100644 index 00000000..5d9103e0 --- /dev/null +++ b/Assets/Prefabs/AR Default Plane.prefab @@ -0,0 +1,218 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &6970871776553093295 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 944561060162235546} + - component: {fileID: 1658528692346625649} + - component: {fileID: 2801213046663747089} + - component: {fileID: 2241676034651943806} + - component: {fileID: 6605205911538353981} + - component: {fileID: 2750955751871654038} + - component: {fileID: 6286014535748806943} + m_Layer: 0 + m_Name: AR Default Plane + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &944561060162235546 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6970871776553093295} + 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: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1658528692346625649 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6970871776553093295} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f66da7470dce8f4d821d71dd2b1d4ac, type: 3} + m_Name: + m_EditorClassIdentifier: + m_DestroyOnRemoval: 1 + m_VertexChangedThreshold: 0.01 +--- !u!114 &2801213046663747089 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6970871776553093295} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3d180956a54db4646a1c6342921672ad, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!64 &2241676034651943806 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6970871776553093295} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 0} +--- !u!33 &6605205911538353981 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6970871776553093295} + m_Mesh: {fileID: 0} +--- !u!23 &2750955751871654038 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6970871776553093295} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: f1a110d32af21aa4d872c707dfcc6043, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + 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 +--- !u!120 &6286014535748806943 +LineRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6970871776553093295} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 0 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10306, 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_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + 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_Positions: + - {x: 0, y: 0, z: 0} + - {x: 0, y: 0, z: 1} + m_Parameters: + serializedVersion: 3 + widthMultiplier: 1 + widthCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.005 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + colorGradient: + serializedVersion: 2 + key0: {r: 0, g: 0, b: 0, a: 1} + key1: {r: 0, g: 0, b: 0, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + numCornerVertices: 4 + numCapVertices: 4 + alignment: 0 + textureMode: 0 + shadowBias: 0.5 + generateLightingData: 0 + m_UseWorldSpace: 0 + m_Loop: 1 diff --git a/Assets/Prefabs/AR Default Plane.prefab.meta b/Assets/Prefabs/AR Default Plane.prefab.meta new file mode 100644 index 00000000..ac0f426e --- /dev/null +++ b/Assets/Prefabs/AR Default Plane.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b7eca4d169eee364f9dcd3a8681f7b79 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/AR Session Origin.prefab b/Assets/Prefabs/AR Session Origin.prefab new file mode 100644 index 00000000..f92da6b8 --- /dev/null +++ b/Assets/Prefabs/AR Session Origin.prefab @@ -0,0 +1,214 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &7384697051395376287 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7384697051395376290} + - component: {fileID: 7384697051395376286} + - component: {fileID: 7384697051395376291} + - component: {fileID: 7384697051395376288} + - component: {fileID: 7384697051395376289} + m_Layer: 0 + m_Name: AR Camera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7384697051395376290 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7384697051395376287} + 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: 7384697052661678300} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!20 &7384697051395376286 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7384697051395376287} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0, g: 0, b: 0, a: 1} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.1 + far clip plane: 4000 + 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 &7384697051395376291 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7384697051395376287} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1742909100, guid: ed7343f30e3843b3afda8f8b02669cea, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Device: 0 + m_PoseSource: 6 + m_PoseProviderComponent: {fileID: 0} + m_TrackingType: 0 + m_UpdateType: 0 + m_UseRelativeTransform: 1 +--- !u!114 &7384697051395376288 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7384697051395376287} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4966719baa26e4b0e8231a24d9bd491a, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FocusMode: 1 + m_LightEstimationMode: 0 +--- !u!114 &7384697051395376289 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7384697051395376287} + 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} + m_UseCustomRendererAsset: 0 + m_CustomRendererAsset: {fileID: 0} +--- !u!1 &7384697052661678298 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7384697052661678300} + - component: {fileID: 7384697052661678301} + - component: {fileID: 7384697052661678302} + - component: {fileID: 7384697052661678303} + - component: {fileID: 7384697052661678305} + 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!4 &7384697052661678300 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7384697052661678298} + 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: 7384697051395376290} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &7384697052661678301 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7384697052661678298} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 520bb47c46cf8624fafb307b7d1b862a, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Camera: {fileID: 7384697051395376286} +--- !u!114 &7384697052661678302 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7384697052661678298} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fa17d122634046b4a8e23048891fafc5, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &7384697052661678303 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7384697052661678298} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e1760703bbd54c04488a8d10600262ab, type: 3} + m_Name: + m_EditorClassIdentifier: + m_PlanePrefab: {fileID: 6970871776553093295, guid: b7eca4d169eee364f9dcd3a8681f7b79, + type: 3} + m_DetectionMode: -1 +--- !u!114 &7384697052661678305 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7384697052661678298} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8f196b12aeb6b014e8da7db4b63f55c0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Content: {fileID: 0} diff --git a/Assets/Prefabs/AR Session Origin.prefab.meta b/Assets/Prefabs/AR Session Origin.prefab.meta new file mode 100644 index 00000000..9b3908d0 --- /dev/null +++ b/Assets/Prefabs/AR Session Origin.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6cbac4eb09941114a837303d799b9b38 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/GameManager.prefab b/Assets/Prefabs/GameManager.prefab index e169bc67..503c2eb0 100644 --- a/Assets/Prefabs/GameManager.prefab +++ b/Assets/Prefabs/GameManager.prefab @@ -27,6 +27,7 @@ GameObject: - component: {fileID: 5853763562556677784} - component: {fileID: 7588617501852694525} - component: {fileID: 6547606932669875539} + - component: {fileID: 5782684674938460585} m_Layer: 0 m_Name: GameManager m_TagString: Untagged @@ -352,3 +353,15 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 28b5c4d8f70199a438f3c28f59d87264, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &5782684674938460585 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1297494511425690} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6333efbedde42934da078e8243c224fd, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Prefabs/UI.prefab b/Assets/Prefabs/UI.prefab index 7bdcfc8e..d89c467e 100644 --- a/Assets/Prefabs/UI.prefab +++ b/Assets/Prefabs/UI.prefab @@ -4002,6 +4002,85 @@ MonoBehaviour: m_Calls: [] m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +--- !u!1 &3545708936586592019 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4852813206341131325} + - component: {fileID: 5472071332622900968} + - component: {fileID: 8680654522941317644} + m_Layer: 0 + m_Name: AR status text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4852813206341131325 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3545708936586592019} + 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: 7060217674643716524} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: -67} + m_SizeDelta: {x: 300, y: 40} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5472071332622900968 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3545708936586592019} + m_CullTransparentMesh: 0 +--- !u!114 &8680654522941317644 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3545708936586592019} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.074626215, g: 0.4056604, b: 0.077821955, a: 1} + m_RaycastTarget: 0 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 18 + m_FontStyle: 1 + m_BestFit: 0 + m_MinSize: 1 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: 'AR status: ' --- !u!1 &3887136349193210624 GameObject: m_ObjectHideFlags: 0 @@ -7676,6 +7755,7 @@ RectTransform: - {fileID: 2222193836290576247} - {fileID: 122172316996072528} - {fileID: 8743615454504171472} + - {fileID: 4852813206341131325} m_Father: {fileID: 5719983600610341389} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scenes/Demo.unity b/Assets/Scenes/Demo.unity index e7dcb78b..a204dad8 100644 --- a/Assets/Scenes/Demo.unity +++ b/Assets/Scenes/Demo.unity @@ -244,7 +244,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &54778219 GameObject: @@ -474,7 +474,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &109083199 GameObject: @@ -2296,6 +2296,75 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 792000557} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1001 &854322738 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 7384697052661678298, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_Name + value: AR Session Origin + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_RootOrder + value: 6 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 6cbac4eb09941114a837303d799b9b38, type: 3} --- !u!1 &862277649 GameObject: m_ObjectHideFlags: 0 @@ -2386,126 +2455,8 @@ Transform: m_LocalScale: {x: 48, y: 1, z: 48} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1024790305 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1024790310} - - component: {fileID: 1024790309} - - component: {fileID: 1024790308} - - component: {fileID: 1024790307} - - component: {fileID: 1024790306} - - component: {fileID: 1024790311} - m_Layer: 0 - m_Name: Main Camera - m_TagString: MainCamera - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!81 &1024790306 -AudioListener: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1024790305} - m_Enabled: 1 ---- !u!124 &1024790307 -Behaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1024790305} - m_Enabled: 1 ---- !u!92 &1024790308 -Behaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1024790305} - m_Enabled: 1 ---- !u!20 &1024790309 -Camera: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1024790305} - m_Enabled: 1 - serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0.019607844} - m_projectionMatrixMode: 1 - m_SensorSize: {x: 36, y: 24} - m_LensShift: {x: 0, y: 0} - m_GateFitMode: 2 - m_FocalLength: 50 - m_NormalizedViewPortRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - near clip plane: 0.3 - far clip plane: 1000 - field of view: 60 - orthographic: 0 - orthographic size: 5 - m_Depth: -1 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingPath: -1 - m_TargetTexture: {fileID: 0} - m_TargetDisplay: 0 - m_TargetEye: 3 - m_HDR: 0 - m_AllowMSAA: 1 - m_AllowDynamicResolution: 0 - m_ForceIntoRT: 0 - m_OcclusionCulling: 1 - m_StereoConvergence: 10 - m_StereoSeparation: 0.022 ---- !u!4 &1024790310 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1024790305} - m_LocalRotation: {x: -0.0532625, y: 0.9103561, z: -0.12393946, w: -0.39122108} - m_LocalPosition: {x: 2.7437458, y: 2.38386, z: 2.626285} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1024790311 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1024790305} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 27b72409b037b08459c5c96c104ca2fe, type: 3} - m_Name: - m_EditorClassIdentifier: - toggleKey: 0 - displayLines: 1 - displayGizmos: 0 - zOnShader: {fileID: 4800000, guid: 6602491fb85d04f7facf2932f1831720, type: 3} - zOffShader: {fileID: 4800000, guid: 12cb60961770c4d7e8cc1662ca101fec, type: 3} --- !u!1 &1070915822 GameObject: m_ObjectHideFlags: 0 @@ -2668,6 +2619,64 @@ Transform: - {fileID: 321557369} - {fileID: 1070915823} m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1183502001 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1183502004} + - component: {fileID: 1183502003} + - component: {fileID: 1183502002} + 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 &1183502002 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1183502001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fa850fbd5b8aded44846f96e35f1a9f5, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &1183502003 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1183502001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3859a92a05d4f5d418cb6ca605290e74, type: 3} + m_Name: + m_EditorClassIdentifier: + m_AttemptUpdate: 1 + m_MatchFrameRate: 1 +--- !u!4 &1183502004 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1183502001} + 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: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1250333810 @@ -2737,7 +2746,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 1 + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1293882087 GameObject: diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index d458bb9d..0f3ac5bf 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 1430544495} - m_IndirectSpecularColor: {r: 0.4465946, g: 0.49643135, b: 0.5748264, a: 1} + m_IndirectSpecularColor: {r: 0.44657892, g: 0.49641353, b: 0.5748163, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -112,7 +112,7 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!1 &1117230320 +--- !u!1 &1097974100 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -120,107 +120,56 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 1117230324} - - component: {fileID: 1117230323} - - component: {fileID: 1117230322} - - component: {fileID: 1117230321} - - component: {fileID: 1117230325} + - component: {fileID: 1097974103} + - component: {fileID: 1097974102} + - component: {fileID: 1097974101} m_Layer: 0 - m_Name: Camera - m_TagString: MainCamera + m_Name: AR Session + m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!81 &1117230321 -AudioListener: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1117230320} - m_Enabled: 1 ---- !u!124 &1117230322 -Behaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1117230320} - m_Enabled: 1 ---- !u!20 &1117230323 -Camera: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1117230320} - m_Enabled: 1 - serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} - m_projectionMatrixMode: 1 - m_SensorSize: {x: 36, y: 24} - m_LensShift: {x: 0, y: 0} - m_GateFitMode: 2 - m_FocalLength: 50 - m_NormalizedViewPortRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - near clip plane: 0.3 - far clip plane: 1000 - 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!4 &1117230324 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1117230320} - m_LocalRotation: {x: 0, y: 0.73046196, z: 0, w: 0.6829534} - m_LocalPosition: {x: 2106.089, y: 40, z: 1848.0103} - m_LocalScale: {x: 1.0000002, y: 1, z: 1.0000005} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1117230325 +--- !u!114 &1097974101 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1117230320} + m_GameObject: {fileID: 1097974100} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 27b72409b037b08459c5c96c104ca2fe, type: 3} + m_Script: {fileID: 11500000, guid: fa850fbd5b8aded44846f96e35f1a9f5, type: 3} m_Name: m_EditorClassIdentifier: - toggleKey: 0 - displayLines: 1 - displayGizmos: 0 - zOnShader: {fileID: 4800000, guid: 6602491fb85d04f7facf2932f1831720, type: 3} - zOffShader: {fileID: 4800000, guid: 12cb60961770c4d7e8cc1662ca101fec, type: 3} +--- !u!114 &1097974102 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1097974100} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3859a92a05d4f5d418cb6ca605290e74, type: 3} + m_Name: + m_EditorClassIdentifier: + m_AttemptUpdate: 1 + m_MatchFrameRate: 1 +--- !u!4 &1097974103 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1097974100} + 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!108 &1430544495 stripped Light: m_CorrespondingSourceObject: {fileID: 10808534, guid: b6900baf9f552ba46ad27d4ada4d5489, @@ -264,7 +213,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 400000, guid: 780611a67e8e941a2b3aa96e5915a793, type: 3} propertyPath: m_RootOrder - value: 2 + value: 1 objectReference: {fileID: 0} - target: {fileID: 400000, guid: 780611a67e8e941a2b3aa96e5915a793, type: 3} propertyPath: m_LocalScale.x @@ -304,7 +253,7 @@ PrefabInstance: - target: {fileID: 11436500, guid: b6900baf9f552ba46ad27d4ada4d5489, type: 3} propertyPath: Focus value: - objectReference: {fileID: 1117230324} + objectReference: {fileID: 0} - target: {fileID: 11436500, guid: b6900baf9f552ba46ad27d4ada4d5489, type: 3} propertyPath: focusPoints.Array.data[0] value: @@ -339,7 +288,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 499186, guid: b6900baf9f552ba46ad27d4ada4d5489, type: 3} propertyPath: m_RootOrder - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 11455068, guid: b6900baf9f552ba46ad27d4ada4d5489, type: 3} propertyPath: WaterPrefab @@ -347,3 +296,83 @@ PrefabInstance: objectReference: {fileID: 1631170489} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: b6900baf9f552ba46ad27d4ada4d5489, type: 3} +--- !u!4 &2088939133 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 499186, guid: b6900baf9f552ba46ad27d4ada4d5489, + type: 3} + m_PrefabInstance: {fileID: 2088939132} + m_PrefabAsset: {fileID: 0} +--- !u!1001 &7384697051527278529 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 7384697052661678298, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_Name + value: AR Session Origin + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678300, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7384697052661678305, guid: 6cbac4eb09941114a837303d799b9b38, + type: 3} + propertyPath: m_Content + value: + objectReference: {fileID: 2088939133} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 6cbac4eb09941114a837303d799b9b38, type: 3} diff --git a/Assets/Scripts/AR.meta b/Assets/Scripts/AR.meta new file mode 100644 index 00000000..3a2ab8d9 --- /dev/null +++ b/Assets/Scripts/AR.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5570c6e7cdf9a9e4c9a3bff691f4ef38 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/AR/ARManager.cs b/Assets/Scripts/AR/ARManager.cs new file mode 100644 index 00000000..13c5d96d --- /dev/null +++ b/Assets/Scripts/AR/ARManager.cs @@ -0,0 +1,23 @@ +using SanAndreasUnity.Utilities; +using UnityEngine; +using UnityEngine.UI; +using UnityEngine.XR.ARFoundation; + +namespace SanAndreasUnity.AR +{ + public class ARManager : MonoBehaviour + { + private Text _arStatusText; + + private void Awake() + { + _arStatusText = GameObject.Find("AR status text").GetComponentOrThrow(); + } + + void Update() + { + _arStatusText.text = "AR status: " + ARSession.state; + } + + } +} diff --git a/Assets/Scripts/AR/ARManager.cs.meta b/Assets/Scripts/AR/ARManager.cs.meta new file mode 100644 index 00000000..3db7b9d1 --- /dev/null +++ b/Assets/Scripts/AR/ARManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6333efbedde42934da078e8243c224fd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/AR/MakeAppearOnPlane.cs b/Assets/Scripts/AR/MakeAppearOnPlane.cs new file mode 100644 index 00000000..513619e4 --- /dev/null +++ b/Assets/Scripts/AR/MakeAppearOnPlane.cs @@ -0,0 +1,78 @@ +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.XR.ARFoundation; +using UnityEngine.XR.ARSubsystems; + +namespace UnityEngine.XR.ARFoundation.Samples +{ + /// + /// Moves the ARSessionOrigin in such a way that it makes the given content appear to be + /// at a given location acquired via a raycast. + /// + [RequireComponent(typeof(ARSessionOrigin))] + [RequireComponent(typeof(ARRaycastManager))] + public class MakeAppearOnPlane : MonoBehaviour + { + [SerializeField] + [Tooltip("A transform which should be made to appear to be at the touch point.")] + Transform m_Content; + + /// + /// A transform which should be made to appear to be at the touch point. + /// + public Transform content + { + get { return m_Content; } + set { m_Content = value; } + } + + Quaternion m_Rotation = Quaternion.identity; + + /// + /// The rotation the content should appear to have. + /// + public Quaternion rotation + { + get { return m_Rotation; } + set + { + m_Rotation = value; + if (m_SessionOrigin != null) + m_SessionOrigin.MakeContentAppearAt(content, content.transform.position, m_Rotation); + } + } + + void Awake() + { + m_SessionOrigin = GetComponent(); + m_RaycastManager = GetComponent(); + } + + void Update() + { + if (Input.touchCount == 0 || m_Content == null) + return; + + var touch = Input.GetTouch(0); + + if (m_RaycastManager.Raycast(touch.position, s_Hits, TrackableType.PlaneWithinPolygon)) + { + // Raycast hits are sorted by distance, so the first one + // will be the closest hit. + var hitPose = s_Hits[0].pose; + + // This does not move the content; instead, it moves and orients the ARSessionOrigin + // such that the content appears to be at the raycast hit position. + m_SessionOrigin.MakeContentAppearAt(content, hitPose.position, m_Rotation); + + Debug.Log($"MakeContentAppearAt - pos: {hitPose.position}"); + } + } + + static List s_Hits = new List(); + + ARSessionOrigin m_SessionOrigin; + + ARRaycastManager m_RaycastManager; + } +} \ No newline at end of file diff --git a/Assets/Scripts/AR/MakeAppearOnPlane.cs.meta b/Assets/Scripts/AR/MakeAppearOnPlane.cs.meta new file mode 100644 index 00000000..9e7878f5 --- /dev/null +++ b/Assets/Scripts/AR/MakeAppearOnPlane.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8f196b12aeb6b014e8da7db4b63f55c0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Behaviours/SpawnManager.cs b/Assets/Scripts/Behaviours/SpawnManager.cs index 6f378b64..60576aeb 100644 --- a/Assets/Scripts/Behaviours/SpawnManager.cs +++ b/Assets/Scripts/Behaviours/SpawnManager.cs @@ -45,8 +45,9 @@ namespace SanAndreasUnity.Behaviours if (Ped.Instance) return Ped.Instance.transform; - if (Camera.main) - return Camera.main.transform; + var cam = Camera.current; + if (cam != null) + return cam.transform; return null; } diff --git a/Assets/Scripts/Settings/WorldSettings.cs b/Assets/Scripts/Settings/WorldSettings.cs index ee901652..7d4a1d29 100644 --- a/Assets/Scripts/Settings/WorldSettings.cs +++ b/Assets/Scripts/Settings/WorldSettings.cs @@ -2,6 +2,7 @@ using UnityEngine; using SanAndreasUnity.Behaviours.World; using SanAndreasUnity.UI; +using UnityEngine.XR.ARFoundation; namespace SanAndreasUnity.Settings { @@ -18,10 +19,26 @@ namespace SanAndreasUnity.Settings { persistType = OptionsWindow.InputPersistType.OnStart }; + private float _arScaleValue = 0f; + + private readonly OptionsWindow.FloatInput m_arScale = new OptionsWindow.FloatInput + { + description = "AR scale", + minValue = -1f, + maxValue = 1f, + persistType = OptionsWindow.InputPersistType.OnStart, + }; + + private ARSessionOrigin _arSessionOrigin; + void Awake () { - OptionsWindow.RegisterInputs ("WORLD", m_maxDrawDistanceInput); + m_arScale.getValue = () => _arScaleValue; + m_arScale.setValue = SetArScale; + + OptionsWindow.RegisterInputs ("WORLD", m_maxDrawDistanceInput, m_arScale); + UnityEngine.SceneManagement.SceneManager.activeSceneChanged += (s1, s2) => OnActiveSceneChanged(); } @@ -33,7 +50,24 @@ namespace SanAndreasUnity.Settings { Cell cell = Object.FindObjectOfType(); if (cell != null) cell.maxDrawDistance = s_maxDrawDistance; - + + + _arSessionOrigin = FindObjectOfType(); + SetArScale(_arScaleValue); + } + + void SetArScale(float value) + { + _arScaleValue = value; + + if (_arSessionOrigin != null) + { + float absValue = Mathf.Abs(_arScaleValue); + + float scale = Mathf.Pow(2.7f, absValue * 8); // max is 2.7^8 = ~2800 + + _arSessionOrigin.transform.localScale = _arScaleValue >= 0f ? Vector3.one * scale : Vector3.one * 1f / scale; + } } } diff --git a/Packages/manifest.json b/Packages/manifest.json index 5966e700..0c5b67f5 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,6 +1,8 @@ { "dependencies": { "com.unity.package-manager-ui": "2.0.7", + "com.unity.xr.arcore": "2.2.0-preview.6", + "com.unity.xr.arfoundation": "1.5.0-preview.7", "com.unity.modules.ai": "1.0.0", "com.unity.modules.animation": "1.0.0", "com.unity.modules.assetbundle": "1.0.0", diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index fc83d6bc..e9b545af 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -156,7 +156,7 @@ PlayerSettings: Android: com.SAUnity.SAUnity buildNumber: {} AndroidBundleVersionCode: 6 - AndroidMinSdkVersion: 16 + AndroidMinSdkVersion: 24 AndroidTargetSdkVersion: 0 AndroidPreferredInstallLocation: 1 aotOptions: