Fixed index of out bounds error, issue with head not being tracked in

PrioVR.
This commit is contained in:
Andrzej Kapolka 2014-05-15 18:22:57 -07:00
parent e5ef65242f
commit e415006526
2 changed files with 3 additions and 1 deletions

View file

@ -150,7 +150,8 @@ int ControllerScriptingInterface::getNumberOfJoysticks() const {
glm::vec2 ControllerScriptingInterface::getJoystickPosition(int joystickIndex) const { glm::vec2 ControllerScriptingInterface::getJoystickPosition(int joystickIndex) const {
// we know there's one joystick per palm, so the joystickIndex is the palm Index // we know there's one joystick per palm, so the joystickIndex is the palm Index
int managedJoystickIndex = joystickIndex - getNumberOfActivePalms(); int managedJoystickIndex = joystickIndex - getNumberOfActivePalms();
if (managedJoystickIndex >= 0) { if (managedJoystickIndex >= 0 && managedJoystickIndex <
Application::getInstance()->getJoystickManager()->getJoystickStates().size()) {
const JoystickState& state = Application::getInstance()->getJoystickManager()->getJoystickStates().at( const JoystickState& state = Application::getInstance()->getJoystickManager()->getJoystickStates().at(
managedJoystickIndex); managedJoystickIndex);
return glm::vec2(state.axes.size() > 0 ? state.axes.at(0) : 0.0f, state.axes.size() > 1 ? state.axes.at(1) : 0.0f); return glm::vec2(state.axes.size() > 0 ? state.axes.at(0) : 0.0f, state.axes.size() > 1 ? state.axes.at(1) : 0.0f);

View file

@ -585,6 +585,7 @@ const char* HUMANIK_JOINTS[] = {
"LeftArm", "LeftArm",
"LeftForeArm", "LeftForeArm",
"LeftHand", "LeftHand",
"Neck",
"Spine", "Spine",
"Hips", "Hips",
"RightUpLeg", "RightUpLeg",