only active sixsense palms

This commit is contained in:
Brad Hefta-Gaub 2015-01-04 12:26:30 -08:00
parent 218ae9c9d8
commit 89e499a78f

View file

@ -146,11 +146,6 @@ void SixenseManager::update(float deltaTime) {
#ifdef HAVE_SIXENSE
Hand* hand = Application::getInstance()->getAvatar()->getHand();
if (_isInitialized && _isEnabled) {
// Disable the hands (and return to default pose) if both controllers are at base station
for (std::vector<PalmData>::iterator it = hand->getPalms().begin(); it != hand->getPalms().end(); it++) {
it->setActive(!_controllersAtBase);
}
#ifdef __APPLE__
SixenseBaseFunction sixenseGetNumActiveControllers =
(SixenseBaseFunction) _sixenseLibrary->resolve("sixenseGetNumActiveControllers");
@ -213,6 +208,14 @@ void SixenseManager::update(float deltaTime) {
qDebug("Found new Sixense controller, ID %i", data->controller_index);
}
// Disable the hands (and return to default pose) if both controllers are at base station
if (foundHand) {
palm->setActive(!_controllersAtBase);
} else {
palm->setActive(false); // if this isn't a Sixsense ID palm, always make it inactive
}
// Read controller buttons and joystick into the hand
palm->setControllerButtons(data->buttons);
palm->setTrigger(data->trigger);