forked from MattRix/UnityDecompiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVRNodeState.cs
More file actions
137 lines (115 loc) · 2.49 KB
/
Copy pathVRNodeState.cs
File metadata and controls
137 lines (115 loc) · 2.49 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
using System;
using UnityEngine.Scripting;
namespace UnityEngine.VR
{
[UsedByNativeCode]
public struct VRNodeState
{
private VRNode m_Type;
private AvailableTrackingData m_AvailableFields;
private Vector3 m_Position;
private Quaternion m_Rotation;
private Vector3 m_Velocity;
private Quaternion m_AngularVelocity;
private Vector3 m_Acceleration;
private Quaternion m_AngularAcceleration;
private int m_Tracked;
private ulong m_UniqueID;
public ulong uniqueID
{
get
{
return this.m_UniqueID;
}
set
{
this.m_UniqueID = value;
}
}
public VRNode nodeType
{
get
{
return this.m_Type;
}
set
{
this.m_Type = value;
}
}
public bool tracked
{
get
{
return this.m_Tracked == 1;
}
set
{
this.m_Tracked = ((!value) ? 0 : 1);
}
}
public Vector3 position
{
set
{
this.m_Position = value;
this.m_AvailableFields |= AvailableTrackingData.PositionAvailable;
}
}
public Quaternion rotation
{
set
{
this.m_Rotation = value;
this.m_AvailableFields |= AvailableTrackingData.RotationAvailable;
}
}
public Vector3 velocity
{
set
{
this.m_Velocity = value;
this.m_AvailableFields |= AvailableTrackingData.VelocityAvailable;
}
}
public Vector3 acceleration
{
set
{
this.m_Acceleration = value;
this.m_AvailableFields |= AvailableTrackingData.AccelerationAvailable;
}
}
public bool TryGetPosition(out Vector3 position)
{
return this.TryGet<Vector3>(this.m_Position, AvailableTrackingData.PositionAvailable, out position);
}
public bool TryGetRotation(out Quaternion rotation)
{
return this.TryGet<Quaternion>(this.m_Rotation, AvailableTrackingData.RotationAvailable, out rotation);
}
public bool TryGetVelocity(out Vector3 velocity)
{
return this.TryGet<Vector3>(this.m_Velocity, AvailableTrackingData.VelocityAvailable, out velocity);
}
public bool TryGetAcceleration(out Vector3 acceleration)
{
return this.TryGet<Vector3>(this.m_Acceleration, AvailableTrackingData.AccelerationAvailable, out acceleration);
}
private bool TryGet<T>(T inValue, AvailableTrackingData availabilityFlag, out T outValue) where T : new()
{
bool result;
if (this.m_Tracked == 1 && (this.m_AvailableFields & availabilityFlag) > AvailableTrackingData.None)
{
outValue = inValue;
result = true;
}
else
{
outValue = Activator.CreateInstance<T>();
result = false;
}
return result;
}
}
}