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

71 行
1.7 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
public class DisableTrackedVisuals : MonoBehaviour
{
[SerializeField]
[Tooltip("Disables spawned feature points and the ARPointCloudManager")]
bool m_DisableFeaturePoints;
public bool disableFeaturePoints
{
get => m_DisableFeaturePoints;
set => m_DisableFeaturePoints = value;
}
[SerializeField]
[Tooltip("Disables spawned planes and ARPlaneManager")]
bool m_DisablePlaneRendering;
public bool disablePlaneRendering
{
get => m_DisablePlaneRendering;
set => m_DisablePlaneRendering = value;
}
[SerializeField]
ARPointCloudManager m_PointCloudManager;
public ARPointCloudManager pointCloudManager
{
get => m_PointCloudManager;
set => m_PointCloudManager = value;
}
[SerializeField]
ARPlaneManager m_PlaneManager;
public ARPlaneManager planeManager
{
get => m_PlaneManager;
set => m_PlaneManager = value;
}
void OnEnable()
{
PlaceObjectsOnPlane.onPlacedObject += OnPlacedObject;
}
void OnDisable()
{
PlaceObjectsOnPlane.onPlacedObject -= OnPlacedObject;
}
void OnPlacedObject()
{
if (m_DisableFeaturePoints)
{
m_PointCloudManager.SetTrackablesActive(false);
m_PointCloudManager.enabled = false;
}
if (m_DisablePlaneRendering)
{
m_PlaneManager.SetTrackablesActive(false);
m_PlaneManager.enabled = false;
}
}
}