|
13 | 13 | using UnityEngine.InputSystem.Utilities; |
14 | 14 | using UnityEngine.InputSystem.XR; |
15 | 15 | using TrackingState = UnityEngine.XR.InputTrackingState; |
| 16 | +using UnityPoseControl = UnityEngine.InputSystem.XR.PoseControl; |
| 17 | +#if VIU_OPENXR_PLUGIN_POSE_CONTROL |
| 18 | +using OpenXRPoseControl = UnityEngine.XR.OpenXR.Input.PoseControl; |
| 19 | +#endif |
16 | 20 |
|
17 | 21 | namespace HTC.UnityPlugin.Vive |
18 | 22 | { |
@@ -263,7 +267,17 @@ private void OnRoleValueMappingChanged(ViveRole.IMap map, ViveRole.MappingChange |
263 | 267 | public EnumArray<ControllerAxis, AxisControl>.IReadOnly axises { get { return _axises.ReadOnly; } } |
264 | 268 | public StickControl pad { get; private set; } |
265 | 269 | public StickControl joystick { get; private set; } |
266 | | - public PoseControl pose { get; private set; } |
| 270 | + |
| 271 | + public UnityPoseControl pose { get; private set; } |
| 272 | +#if VIU_OPENXR_PLUGIN_POSE_CONTROL |
| 273 | + public OpenXRPoseControl openxr_pose { get; private set; } |
| 274 | +#endif |
| 275 | + public ButtonControl isTracked { get; private set; } |
| 276 | + public IntegerControl trackingState { get; private set; } |
| 277 | + public Vector3Control position { get; private set; } |
| 278 | + public QuaternionControl rotation { get; private set; } |
| 279 | + public Vector3Control velocity { get; private set; } |
| 280 | + public Vector3Control angularVelocity { get; private set; } |
267 | 281 |
|
268 | 282 | static VIUSyntheticDevice() |
269 | 283 | { |
@@ -491,10 +505,20 @@ public static VIUSyntheticDevice InternalGetCreatedDeviceByRole(Type roleEnumTyp |
491 | 505 |
|
492 | 506 | protected override void FinishSetup() |
493 | 507 | { |
494 | | - pose = GetChildControl<PoseControl>("pose"); |
495 | | - |
496 | 508 | base.FinishSetup(); |
497 | 509 |
|
| 510 | + var poseGeneric = GetChildControl("pose"); |
| 511 | + pose = poseGeneric as UnityPoseControl; |
| 512 | +#if VIU_OPENXR_PLUGIN_POSE_CONTROL |
| 513 | + openxr_pose = poseGeneric as OpenXRPoseControl; |
| 514 | +#endif |
| 515 | + isTracked = GetChildControl<ButtonControl>("pose/isTracked"); |
| 516 | + trackingState = GetChildControl<IntegerControl>("pose/trackingState"); |
| 517 | + position = GetChildControl<Vector3Control>("pose/position"); |
| 518 | + rotation = GetChildControl<QuaternionControl>("pose/rotation"); |
| 519 | + velocity = GetChildControl<Vector3Control>("pose/velocity"); |
| 520 | + angularVelocity = GetChildControl<Vector3Control>("pose/angularVelocity"); |
| 521 | + |
498 | 522 | pad = GetChildControl<StickControl>("PadAxis"); |
499 | 523 | joystick = GetChildControl<StickControl>("JoystickAxis"); |
500 | 524 |
|
|
0 commit comments