Merge pull request #3869 from ctrlaltdavid/fix-leap-hands-in-face

Fix Leap hands in face
This commit is contained in:
Philip Rosedale 2014-11-26 15:49:29 -08:00
commit f0fa627892
3 changed files with 26 additions and 19 deletions

View file

@ -471,17 +471,20 @@ var leapHands = (function () {
} else {
hands[h].inactiveCount += 1;
if (hands[h].inactiveCount < MAX_HAND_INACTIVE_COUNT) {
if (hands[h].inactiveCount === MAX_HAND_INACTIVE_COUNT) {
if (h === 0) {
MyAvatar.clearJointData("LeftHand");
MyAvatar.clearJointData("LeftForeArm");
MyAvatar.clearJointData("LeftArm");
} else {
MyAvatar.clearJointData("RightHand");
MyAvatar.clearJointData("RightForeArm");
MyAvatar.clearJointData("RightArm");
hands[h].inactiveCount += 1;
if (hands[h].inactiveCount === MAX_HAND_INACTIVE_COUNT) {
if (h === 0) {
MyAvatar.clearJointData("LeftHand");
MyAvatar.clearJointData("LeftForeArm");
MyAvatar.clearJointData("LeftArm");
} else {
MyAvatar.clearJointData("RightHand");
MyAvatar.clearJointData("RightForeArm");
MyAvatar.clearJointData("RightArm");
}
}
}
}

View file

@ -135,16 +135,20 @@ glm::vec3 vec3FromLeapVector(const Leap::Vector& vec) {
void Leapmotion::update() {
#ifdef HAVE_LEAPMOTION
// Check that the controller is actually active
bool wasActive = _active;
_active = _controller.isConnected();
if (!_active) {
return;
if (_active || wasActive) {
// Go through all the joints and increment their counter since last update.
// Increment all counters once after controller first becomes inactive so that each joint reports itself as inactive.
// TODO C++11 for (auto jointIt = _jointsArray.begin(); jointIt != _jointsArray.end(); jointIt++) {
for (JointTracker::Vector::iterator jointIt = _jointsArray.begin(); jointIt != _jointsArray.end(); jointIt++) {
(*jointIt).tickNewFrame();
}
}
// go through all the joints and increment their counter since last update
// TODO C++11 for (auto jointIt = _jointsArray.begin(); jointIt != _jointsArray.end(); jointIt++) {
for (JointTracker::Vector::iterator jointIt = _jointsArray.begin(); jointIt != _jointsArray.end(); jointIt++) {
(*jointIt).tickNewFrame();
if (!_active) {
return;
}
// Get the most recent frame and report some basic information

View file

@ -119,14 +119,14 @@ MotionTracker::JointTracker::JointTracker() :
_absFrame(),
_semantic(""),
_parent(INVALID_PARENT),
_lastUpdate(0)
_lastUpdate(1) // Joint inactive
{
}
MotionTracker::JointTracker::JointTracker(const Semantic& semantic, Index parent) :
_semantic(semantic),
_parent(parent),
_lastUpdate(0)
_lastUpdate(1) // Joint inactive
{
}