From 843a4db650110ac242e2e6a2c70b4dfd4dcc97c0 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 3 Jul 2014 13:50:27 -0700 Subject: [PATCH 1/3] rotation offset for hydra controllers --- interface/src/devices/SixenseManager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interface/src/devices/SixenseManager.cpp b/interface/src/devices/SixenseManager.cpp index 1b7baf2ee1..b0e49013b3 100644 --- a/interface/src/devices/SixenseManager.cpp +++ b/interface/src/devices/SixenseManager.cpp @@ -154,6 +154,11 @@ void SixenseManager::update(float deltaTime) { // no latency. float velocityFilter = glm::clamp(1.0f - glm::length(rawVelocity), 0.0f, 1.0f); palm->setRawPosition(palm->getRawPosition() * velocityFilter + position * (1.0f - velocityFilter)); + + // adjustment for hydra controllers fit into hands + float sign = (i == 0) ? -1.0f : 1.0f; + rotation *= glm::angleAxis(sign * PI/4.0f, glm::vec3(0.0f, 0.0f, 1.0f)); + palm->setRawRotation(safeMix(palm->getRawRotation(), rotation, 1.0f - velocityFilter)); // use the velocity to determine whether there's any movement (if the hand isn't new) From 0f7859bf83ef139b757d3ae9c011260c4a1cb091 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 3 Jul 2014 14:09:14 -0700 Subject: [PATCH 2/3] fix return to default pose after hydra disconnect --- interface/src/devices/SixenseManager.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/interface/src/devices/SixenseManager.cpp b/interface/src/devices/SixenseManager.cpp index b0e49013b3..7cdd2a64ae 100644 --- a/interface/src/devices/SixenseManager.cpp +++ b/interface/src/devices/SixenseManager.cpp @@ -71,6 +71,15 @@ void SixenseManager::setFilter(bool filter) { void SixenseManager::update(float deltaTime) { #ifdef HAVE_SIXENSE + // if the controllers haven't been moved in a while, disable + const unsigned int MOVEMENT_DISABLE_SECONDS = 3; + if (usecTimestampNow() - _lastMovement > (MOVEMENT_DISABLE_SECONDS * USECS_PER_SECOND)) { + Hand* hand = Application::getInstance()->getAvatar()->getHand(); + for (std::vector::iterator it = hand->getPalms().begin(); it != hand->getPalms().end(); it++) { + it->setActive(false); + } + } + if (sixenseGetNumActiveControllers() == 0) { _hydrasConnected = false; return; @@ -185,14 +194,6 @@ void SixenseManager::update(float deltaTime) { if (numActiveControllers == 2) { updateCalibration(controllers); } - - // if the controllers haven't been moved in a while, disable - const unsigned int MOVEMENT_DISABLE_SECONDS = 3; - if (usecTimestampNow() - _lastMovement > (MOVEMENT_DISABLE_SECONDS * USECS_PER_SECOND)) { - for (std::vector::iterator it = hand->getPalms().begin(); it != hand->getPalms().end(); it++) { - it->setActive(false); - } - } #endif // HAVE_SIXENSE } From 662136f01c4936e18aa2ef425c782bf3887a15d2 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 3 Jul 2014 14:13:27 -0700 Subject: [PATCH 3/3] reset timer as optimization --- interface/src/devices/SixenseManager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/src/devices/SixenseManager.cpp b/interface/src/devices/SixenseManager.cpp index 7cdd2a64ae..c50fc887d6 100644 --- a/interface/src/devices/SixenseManager.cpp +++ b/interface/src/devices/SixenseManager.cpp @@ -78,6 +78,7 @@ void SixenseManager::update(float deltaTime) { for (std::vector::iterator it = hand->getPalms().begin(); it != hand->getPalms().end(); it++) { it->setActive(false); } + _lastMovement = usecTimestampNow(); } if (sixenseGetNumActiveControllers() == 0) {