|
|
|
|
|
|
namespace UnityEngine.XR.ARFoundation.Samples |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// On ARKit, HDR light estimation only works in face tracking mode.
|
|
|
|
/// On ARCore, HDR light estimation only works when NOT in face tracking mode.
|
|
|
|
/// This script enables face tracking on iOS and disables it otherwise.
|
|
|
|
/// This script enables face tracking with user facing camera and disables it otherwise.
|
|
|
|
/// It enables the world space object with world facing camera and disables it otherwise.
|
|
|
|
/// </summary>
|
|
|
|
[RequireComponent(typeof(ARSessionOrigin))] |
|
|
|
[RequireComponent(typeof(ARFaceManager))] |
|
|
|
|
|
|
[SerializeField] |
|
|
|
[SerializeField] |
|
|
|
GameObject m_WorldSpaceObject; |
|
|
|
|
|
|
|
public GameObject worldSpaceObject |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
CameraFacingDirection updatedCameraFacingDirection; |
|
|
|
CameraFacingDirection originalCameraFacingDirection; |
|
|
|
CameraFacingDirection m_CurrentCameraFacingDirection; |
|
|
|
ARCameraManager m_CameraManager; |
|
|
|
|
|
|
|
originalCameraFacingDirection = GetComponentInChildren<ARCameraManager>().currentFacingDirection; |
|
|
|
updatedCameraFacingDirection = originalCameraFacingDirection; |
|
|
|
m_CameraManager = GetComponentInChildren<ARCameraManager>(); |
|
|
|
m_CurrentCameraFacingDirection = m_CameraManager.currentFacingDirection; |
|
|
|
updatedCameraFacingDirection = GetComponentInChildren<ARCameraManager>().currentFacingDirection; |
|
|
|
if (updatedCameraFacingDirection != CameraFacingDirection.None && updatedCameraFacingDirection != originalCameraFacingDirection) |
|
|
|
var updatedCameraFacingDirection = m_CameraManager.currentFacingDirection; |
|
|
|
if (updatedCameraFacingDirection != CameraFacingDirection.None && updatedCameraFacingDirection != m_CurrentCameraFacingDirection) |
|
|
|
originalCameraFacingDirection = updatedCameraFacingDirection; |
|
|
|
m_CurrentCameraFacingDirection = updatedCameraFacingDirection; |
|
|
|
originalCameraFacingDirection = updatedCameraFacingDirection; |
|
|
|
m_CurrentCameraFacingDirection = updatedCameraFacingDirection; |
|
|
|
GetComponent<ARFaceManager>().enabled = false; |
|
|
|
worldSpaceObject.SetActive(true); |
|
|
|
Application.onBeforeRender += OnBeforeRender; |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |