您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

44 行
1.2 KiB

using UnityEngine;
using UnityEngine.XR.ARFoundation;
namespace UnityEngine.XR.ARFoundation.Samples
{
public class ToggleCameraFacingDirection : MonoBehaviour
{
[SerializeField]
ARCameraManager m_CameraManager;
public ARCameraManager cameraManager
{
get => m_CameraManager;
set => m_CameraManager = value;
}
[SerializeField]
ARSession m_Session;
public ARSession session
{
get => m_Session;
set => m_Session = value;
}
void Update()
{
if (m_CameraManager == null || m_Session == null)
return;
if (Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Began)
{
if (m_CameraManager.requestedFacingDirection == CameraFacingDirection.User)
{
m_CameraManager.requestedFacingDirection = CameraFacingDirection.World;
}
else
{
m_CameraManager.requestedFacingDirection = CameraFacingDirection.User;
}
}
}
}
}