hydra hands hard coded to LH and RH controllers, ball debugging

This commit is contained in:
Philip Rosedale 2013-12-17 09:41:13 -08:00
parent d4bad3421f
commit fc28034f37
2 changed files with 9 additions and 8 deletions

View file

@ -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]],

View file

@ -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;
}
}
}