From fc28034f3722f3933572dfd74c1d9b3ae9ac0710 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Tue, 17 Dec 2013 09:41:13 -0800 Subject: [PATCH] hydra hands hard coded to LH and RH controllers, ball debugging --- interface/src/avatar/Hand.cpp | 3 +++ libraries/avatars/src/HandData.cpp | 14 ++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/interface/src/avatar/Hand.cpp b/interface/src/avatar/Hand.cpp index fea593a653..cb2ccab1ae 100755 --- a/interface/src/avatar/Hand.cpp +++ b/interface/src/avatar/Hand.cpp @@ -98,6 +98,7 @@ void Hand::simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, f glm::vec3 newVelocity = NO_VELOCITY; // update the particle with it's new state... + qDebug("Update caught particle!\n"); caughtParticle->updateParticle(newPosition, closestParticle->getRadius(), closestParticle->getXColor(), @@ -157,6 +158,7 @@ void Hand::simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, f } } else { // Ball is in hand + //qDebug("Ball in hand\n"); glm::vec3 ballPosition = ballFromHand ? palm.getPosition() : fingerTipPosition; _ballParticleEditHandles[handID]->updateParticle(ballPosition / (float)TREE_SCALE, TOY_BALL_RADIUS / (float) TREE_SCALE, @@ -178,6 +180,7 @@ void Hand::simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, f ballVelocity = avatarRotation * ballVelocity; // ball is no longer in hand... + qDebug("Threw ball, v = %.3f\n", glm::length(ballVelocity)); _ballParticleEditHandles[handID]->updateParticle(ballPosition / (float)TREE_SCALE, TOY_BALL_RADIUS / (float) TREE_SCALE, TOY_BALL_ON_SERVER_COLOR[_whichBallColor[handID]], diff --git a/libraries/avatars/src/HandData.cpp b/libraries/avatars/src/HandData.cpp index e46620398e..cf91af902a 100644 --- a/libraries/avatars/src/HandData.cpp +++ b/libraries/avatars/src/HandData.cpp @@ -38,22 +38,20 @@ PalmData& HandData::addNewPalm() { return _palms.back(); } +const int SIXENSE_CONTROLLER_ID_LEFT_HAND = 0; +const int SIXENSE_CONTROLLER_ID_RIGHT_HAND = 1; + void HandData::getLeftRightPalmIndices(int& leftPalmIndex, int& rightPalmIndex) const { leftPalmIndex = -1; - float leftPalmX = FLT_MAX; - rightPalmIndex = -1; - float rightPalmX = -FLT_MAX; + rightPalmIndex = -1; for (int i = 0; i < _palms.size(); i++) { const PalmData& palm = _palms[i]; if (palm.isActive()) { - float x = palm.getRawPosition().x; - if (x < leftPalmX) { + if (palm.getSixenseID() == SIXENSE_CONTROLLER_ID_LEFT_HAND) { leftPalmIndex = i; - leftPalmX = x; } - if (x > rightPalmX) { + if (palm.getSixenseID() == SIXENSE_CONTROLLER_ID_RIGHT_HAND) { rightPalmIndex = i; - rightPalmX = x; } } }