-
Notifications
You must be signed in to change notification settings - Fork 127
/
Copy pathControllerLookup.cs
70 lines (62 loc) · 2.14 KB
/
ControllerLookup.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
// Copyright (c) Mixed Reality Toolkit Contributors
// Licensed under the BSD 3-Clause
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;
namespace MixedReality.Toolkit
{
/// <summary>
/// A basic convenience registry allowing easy reference
/// to controllers.
/// </summary>
[DisallowMultipleComponent]
[AddComponentMenu("MRTK/Core/Controller Lookup")]
public class ControllerLookup : MonoBehaviour
{
// Gaze
[SerializeField]
[Tooltip("The camera rig's gaze controller.")]
private XRBaseController gazeController = null;
/// <summary>
/// The camera rig's gaze controller.
/// </summary>
public XRBaseController GazeController
{
get => gazeController;
set => gazeController = value;
}
// Left Hand
[SerializeField]
[Tooltip("The camera rig's left hand controller.")]
private XRBaseController leftHandController = null;
/// <summary>
/// The camera rig's left hand controller.
/// </summary>
public XRBaseController LeftHandController
{
get => leftHandController;
set => leftHandController = value;
}
// Right Hand
[SerializeField]
[Tooltip("The camera rig's right hand controller.")]
private XRBaseController rightHandController = null;
/// <summary>
/// The camera rig's right hand controller.
/// </summary>
public XRBaseController RightHandController
{
get => rightHandController;
set => rightHandController = value;
}
/// <summary>
/// A Unity Editor only event function that is called when the script is loaded or a value changes in the Unity Inspector.
/// </summary>
private void OnValidate()
{
if (FindObjectUtility.FindObjectsByType<ControllerLookup>(false, false).Length > 1)
{
Debug.LogWarning("Found more than one instance of the ControllerLookup class in the hierarchy. There should only be one");
}
}
}
}