From 9ab8fecff5101f2e06d07210b045f39fd890f17c Mon Sep 17 00:00:00 2001 From: Eric Johnston Date: Mon, 22 Jul 2013 07:19:25 -0700 Subject: [PATCH] Minor tweaks to Rave Glove mode, per Ryan's testing 1. Improve response by using unfiltered data from Leap library 2. Reduce distracting arm-flail by only attaching the arm to che glove when we're not in rave mode. --- interface/src/LeapManager.cpp | 7 +++++++ interface/src/avatar/Avatar.cpp | 11 ++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/interface/src/LeapManager.cpp b/interface/src/LeapManager.cpp index a941d0a221..883a9c1037 100755 --- a/interface/src/LeapManager.cpp +++ b/interface/src/LeapManager.cpp @@ -12,6 +12,9 @@ #include // needed for RTLD_LAZY #include +// Uncomment the next line to use Leap-smoothed stabilized (slower) data. +//#define USE_STABILIZED_DATA + bool LeapManager::_libraryExists = false; bool LeapManager::_doFakeFingers = false; Leap::Controller* LeapManager::_controller = NULL; @@ -175,7 +178,11 @@ void LeapManager::nextFrame(Avatar& avatar) { finger.resetFramesWithoutData(); finger.setLeapID(leapFinger.id()); finger.setActive(true); +#ifdef USE_STABILIZED_DATA const Leap::Vector tip = leapFinger.stabilizedTipPosition(); +#else + const Leap::Vector tip = leapFinger.tipPosition(); +#endif const Leap::Vector root = tip - leapFinger.direction() * leapFinger.length(); finger.setRawTipPosition(glm::vec3(tip.x, tip.y, tip.z)); finger.setRawRootPosition(glm::vec3(root.x, root.y, root.z)); diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index ddb78f595b..c2a2d5aadd 100755 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -830,13 +830,14 @@ void Avatar::updateHandMovementAndTouching(float deltaTime, bool enableHandMovem } // If there's a leap-interaction hand visible, use that as the endpoint - for (size_t i = 0; i < getHand().getPalms().size(); ++i) { - PalmData& palm = getHand().getPalms()[i]; - if (palm.isActive()) { - _skeleton.joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position = palm.getPosition(); + if (!getHand().isRaveGloveActive()) { + for (size_t i = 0; i < getHand().getPalms().size(); ++i) { + PalmData& palm = getHand().getPalms()[i]; + if (palm.isActive()) { + _skeleton.joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position = palm.getPosition(); + } } } - }//if (_isMine) //constrain right arm length and re-adjust elbow position as it bends