Lower left and right hands independently when no longer being tracked

This commit is contained in:
David Rowe 2014-09-10 22:29:40 -07:00
parent b4592aceb6
commit c7b34b4f54
2 changed files with 12 additions and 3 deletions

View file

@ -208,6 +208,12 @@ var leapHands = (function () {
leftHandInactiveCount = 0;
} else {
leftHandInactiveCount += 1;
if (leftHandInactiveCount === MAX_HAND_INACTIVE_COUNT) {
MyAvatar.clearJointData("LeftHand");
MyAvatar.clearJointData("LeftForeArm");
MyAvatar.clearJointData("LeftArm");
}
}
if (rightHand.isActive()) {
@ -237,10 +243,12 @@ var leapHands = (function () {
rightHandInactiveCount = 0;
} else {
rightHandInactiveCount += 1;
}
if (leftHandInactiveCount >= MAX_HAND_INACTIVE_COUNT && rightHandInactiveCount >= MAX_HAND_INACTIVE_COUNT) {
MyAvatar.clearJointsData();
if (rightHandInactiveCount === MAX_HAND_INACTIVE_COUNT) {
MyAvatar.clearJointData("RightHand");
MyAvatar.clearJointData("RightForeArm");
MyAvatar.clearJointData("RightArm");
}
}
}

View file

@ -997,6 +997,7 @@ void MyAvatar::clearJointData(int index) {
if (QThread::currentThread() == thread()) {
// HACK: ATM only JS scripts call clearJointData() on MyAvatar so we hardcode the priority
_skeletonModel.setJointState(index, false, glm::quat(), 0.0f);
_skeletonModel.clearJointAnimationPriority(index);
}
}