This repository has been archived by the owner on Jun 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 129
/
DisableTrackedVisuals.cs
71 lines (59 loc) · 1.69 KB
/
DisableTrackedVisuals.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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;
}
}
}