AR Foundation演示项目,使用 AR Foundation 4.1.7 并围绕某些功能演示更高级功能。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

43 行
1.1 KiB

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
public class ProbePlacement : MonoBehaviour
{
[SerializeField]
AREnvironmentProbeManager m_ProbeManager;
public AREnvironmentProbeManager probeManager
{
get => m_ProbeManager;
set => m_ProbeManager = value;
}
[SerializeField]
ARRaycastManager m_RaycastManager;
public ARRaycastManager raycastManager
{
get => m_RaycastManager;
set => m_RaycastManager = value;
}
List<ARRaycastHit> k_Hits = new List<ARRaycastHit>();
void Update()
{
if (Input.touchCount > 0)
{
Touch touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Began)
{
if (m_RaycastManager.Raycast(new Vector2(Screen.width / 2, Screen.height / 2), k_Hits))
{
Pose hitPose = k_Hits[0].pose;
m_ProbeManager.AddEnvironmentProbe(hitPose, Vector3.one, Vector3.one);
}
}
}
}
}