Fixed ARContent facing

This commit is contained in:
Abraham Blain 2023-07-26 22:20:30 -04:00
parent c50e0813f4
commit acb688298c
4 changed files with 64 additions and 12 deletions

View File

@ -25,14 +25,14 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3584092453353435017}
m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0.01, y: -0, z: 0.037}
m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068}
m_LocalPosition: {x: -0.0012, y: 0.0435, z: -0.0031}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5832520631127222786}
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90}
--- !u!33 &3200304953016752685
MeshFilter:
m_ObjectHideFlags: 0
@ -115,7 +115,7 @@ Transform:
- {fileID: 1683565126684304005}
- {fileID: 5483330319324179096}
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1840610342772348991
MonoBehaviour:
@ -132,6 +132,7 @@ MonoBehaviour:
collisionLayer:
serializedVersion: 2
m_Bits: 64
facingBehaviour: 0
--- !u!1 &7897671041226509399
GameObject:
m_ObjectHideFlags: 0

View File

@ -80,6 +80,10 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 7402249168475929347}
m_Modifications:
- target: {fileID: 1840610342772348991, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: facingBehaviour
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3200304953016752685, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_Mesh
value:
@ -88,13 +92,17 @@ PrefabInstance:
propertyPath: m_Name
value: BoxAR
objectReference: {fileID: 0}
- target: {fileID: 5483330319324179096, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5483330319324179096, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5483330319324179096, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_LocalPosition.z
value: -0.020999998
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5483330319324179096, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_LocalRotation.w
@ -104,10 +112,18 @@ PrefabInstance:
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5483330319324179096, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5483330319324179096, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5483330319324179096, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5832520631127222786, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_RootOrder
value: 3
@ -152,6 +168,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7897671041226509399, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
@ -181,6 +201,10 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 7402249168475929347}
m_Modifications:
- target: {fileID: 1840610342772348991, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: facingBehaviour
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3200304953016752685, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_Mesh
value:
@ -189,9 +213,17 @@ PrefabInstance:
propertyPath: m_Name
value: RingAR
objectReference: {fileID: 0}
- target: {fileID: 5483330319324179096, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5483330319324179096, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5483330319324179096, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_LocalPosition.z
value: -0.021
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5483330319324179096, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_LocalRotation.w
@ -201,10 +233,18 @@ PrefabInstance:
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5483330319324179096, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5483330319324179096, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5483330319324179096, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5832520631127222786, guid: fc5d001b36dae68449d99f55804a3d97, type: 3}
propertyPath: m_RootOrder
value: 3

View File

@ -663,14 +663,14 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4560228490934948672}
m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0.0244, y: -0, z: 0.27}
m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0.248, z: -0.026}
m_LocalScale: {x: 5, y: 5, z: 5}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6774865344163518155}
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90}
--- !u!4 &6774865344163518155
Transform:
m_ObjectHideFlags: 0

View File

@ -6,8 +6,9 @@ using UnityEngine;
public class PositionClicker : MonoBehaviour
{
public LayerMask collisionLayer;
public ARFacingBehaviour facingBehaviour;
private Camera cam;
private void Start()
{
cam = Camera.main;
@ -23,8 +24,18 @@ public class PositionClicker : MonoBehaviour
if (!isHit) return;
transform.position = hit.point;
transform.LookAt(cam.transform);
transform.up = hit.normal;
if (facingBehaviour == ARFacingBehaviour.LookAtCamera)
{
transform.LookAt(cam.transform);
}
}
}
public enum ARFacingBehaviour
{
PerpendicularToPlane,
LookAtCamera
}