From c1fdbeb3b42061c3e0d81e8a4487ebef5d8c78be Mon Sep 17 00:00:00 2001 From: Sam Gondelman Date: Tue, 23 Jun 2015 10:52:44 -0700 Subject: [PATCH] hydra dead zone to prevent drifting --- interface/src/devices/SixenseManager.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/interface/src/devices/SixenseManager.cpp b/interface/src/devices/SixenseManager.cpp index c7be89a121..c16611d2e8 100644 --- a/interface/src/devices/SixenseManager.cpp +++ b/interface/src/devices/SixenseManager.cpp @@ -36,6 +36,8 @@ const float NECK_X = 0.25f; // meters const float NECK_Y = 0.3f; // meters const float NECK_Z = 0.3f; // meters +const float CONTROLLER_THRESHOLD = 0.35f; + #ifdef __APPLE__ typedef int (*SixenseBaseFunction)(); typedef int (*SixenseTakeIntFunction)(int); @@ -326,6 +328,12 @@ void SixenseManager::update(float deltaTime) { } _controllersAtBase = (numControllersAtBase == 2); } + + for (auto axisState : _axisStateMap) { + if (fabsf(axisState.second) < CONTROLLER_THRESHOLD) { + _axisStateMap[axisState.first] = 0.0f; + } + } #endif // HAVE_SIXENSE }