AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
DebugInteractionSourcePose.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using UnityEngine;
5 
6 namespace HoloToolkit.Unity.InputModule
7 {
13  {
20  public bool IsPositionAvailable;
21  public bool IsRotationAvailable;
24 
25  public Vector3 Position;
26  public Vector3 Velocity;
27  public Quaternion Rotation;
28  public Ray? PointerRay;
29  public Vector3 GripPosition;
30  public Quaternion GripRotation;
31 
33  {
34  TryGetFunctionsReturnTrue = false;
35  IsPositionAvailable = false;
36  IsRotationAvailable = false;
37  IsGripPositionAvailable = false;
38  IsGripRotationAvailable = false;
39  Position = new Vector3(0, 0, 0);
40  Velocity = new Vector3(0, 0, 0);
41  Rotation = Quaternion.identity;
42  }
43 
44  public bool TryGetPosition(out Vector3 position)
45  {
46  position = Position;
47  if (!TryGetFunctionsReturnTrue) // TODO: bug? does not test IsPositionAvailable (see TryGetRotation)
48  {
49  return false;
50  }
51  return true;
52  }
53 
54  public bool TryGetVelocity(out Vector3 velocity)
55  {
56  velocity = Velocity;
57  if (!TryGetFunctionsReturnTrue)
58  {
59  return false;
60  }
61  return true;
62  }
63 
64  public bool TryGetRotation(out Quaternion rotation)
65  {
66  rotation = Rotation;
67  if (!TryGetFunctionsReturnTrue || !IsRotationAvailable)
68  {
69  return false;
70  }
71  return true;
72  }
73 
74  public bool TryGetPointerRay(out Ray pointerRay)
75  {
76  pointerRay = (Ray)PointerRay;
77  if (PointerRay == null)
78  {
79  return false;
80  }
81  return true;
82  }
83 
84  public bool TryGetGripPosition(out Vector3 position)
85  {
86  position = GripPosition;
87  if (!TryGetFunctionsReturnTrue) // TODO: should test IsGripPositionAvailable? (see TryGetPosition)
88  {
89  return false;
90  }
91  return true;
92  }
93 
94  public bool TryGetGripRotation(out Quaternion rotation)
95  {
96  rotation = GripRotation;
97  if (!TryGetFunctionsReturnTrue || !IsGripRotationAvailable)
98  {
99  return false;
100  }
101  return true;
102  }
103  }
104 }
bool TryGetFunctionsReturnTrue
In the typical InteractionSourcePose, the hardware determines if TryGetPosition and TryGetVelocity wi...
Since the InteractionSourcePose is internal to UnityEngine.VR.WSA.Input, this is a fake InteractionSo...