From 4e49774d0efff81324ee6d13171a379089aaafeb Mon Sep 17 00:00:00 2001
From: "Anthony J. Thibault" <tony@highfidelity.io>
Date: Thu, 6 Apr 2017 13:20:00 -0700
Subject: [PATCH] Moved device class check into handleTrackedObject

---
 plugins/openvr/src/ViveControllerManager.cpp | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/plugins/openvr/src/ViveControllerManager.cpp b/plugins/openvr/src/ViveControllerManager.cpp
index 6fe640b618..86b37135d2 100644
--- a/plugins/openvr/src/ViveControllerManager.cpp
+++ b/plugins/openvr/src/ViveControllerManager.cpp
@@ -142,13 +142,7 @@ void ViveControllerManager::InputDevice::update(float deltaTime, const controlle
 
     // collect poses for all generic trackers
     for (int i = 0; i < vr::k_unMaxTrackedDeviceCount; i++) {
-        if (_system->GetTrackedDeviceClass(i) == vr::TrackedDeviceClass_GenericTracker) {
-            handleTrackedObject(i, inputCalibrationData);
-        } else {
-            uint32_t poseIndex = controller::TRACKED_OBJECT_00 + i;
-            controller::Pose invalidPose;
-            _poseStateMap[poseIndex] = invalidPose;
-        }
+        handleTrackedObject(i, inputCalibrationData);
     }
 
     // handle haptics
@@ -177,6 +171,7 @@ void ViveControllerManager::InputDevice::handleTrackedObject(uint32_t deviceInde
     uint32_t poseIndex = controller::TRACKED_OBJECT_00 + deviceIndex;
 
     if (_system->IsTrackedDeviceConnected(deviceIndex) &&
+        _system->GetTrackedDeviceClass(deviceIndex) == vr::TrackedDeviceClass_GenericTracker &&
         _nextSimPoseData.vrPoses[deviceIndex].bPoseIsValid &&
         poseIndex <= controller::TRACKED_OBJECT_15) {