Showing the changes to interface/src/Application.cpp (1 of 5 files). Show all
Unified · Split
| @@ -2628,22 +2628,21 @@ void Application::update(float deltaTime) { · 2627 unmodified lines | |||
| 2628 | _myAvatar->setDriveKeys(ROT_DOWN, userInputMapper->getActionState(UserInputMapper::PITCH_DOWN)); | 2628 | _myAvatar->setDriveKeys(ROT_DOWN, userInputMapper->getActionState(UserInputMapper::PITCH_DOWN)); |
| 2629 | _myAvatar->setDriveKeys(ROT_LEFT, userInputMapper->getActionState(UserInputMapper::YAW_LEFT)); | 2629 | _myAvatar->setDriveKeys(ROT_LEFT, userInputMapper->getActionState(UserInputMapper::YAW_LEFT)); |
| 2630 | _myAvatar->setDriveKeys(ROT_RIGHT, userInputMapper->getActionState(UserInputMapper::YAW_RIGHT)); | 2630 | _myAvatar->setDriveKeys(ROT_RIGHT, userInputMapper->getActionState(UserInputMapper::YAW_RIGHT)); |
| 2631 | // TODO: set hand positions somehow | ||
| 2632 | UserInputMapper::PoseValue leftHand = userInputMapper->getPoseState(UserInputMapper::LEFT_HAND); | ||
| 2633 | UserInputMapper::PoseValue rightHand = userInputMapper->getPoseState(UserInputMapper::RIGHT_HAND); | ||
| 2634 | Hand* hand = DependencyManager::get<AvatarManager>()->getMyAvatar()->getHand(); | ||
| 2635 | setPalmData(hand, leftHand, LEFT_HAND_INDEX); | ||
| 2636 | setPalmData(hand, rightHand, RIGHT_HAND_INDEX); | ||
| 2637 | if (Menu::getInstance()->isOptionChecked(MenuOption::HandMouseInput)) { | ||
| 2638 | emulateMouse(hand, userInputMapper->getActionState(UserInputMapper::LEFT_HAND_CLICK), | ||
| 2639 | userInputMapper->getActionState(UserInputMapper::SHIFT), LEFT_HAND_INDEX); | ||
| 2640 | emulateMouse(hand, userInputMapper->getActionState(UserInputMapper::RIGHT_HAND_CLICK), | ||
| 2641 | userInputMapper->getActionState(UserInputMapper::SHIFT), RIGHT_HAND_INDEX); | ||
| 2642 | } | ||
| 2643 | } | 2631 | } |
| 2644 | _myAvatar->setDriveKeys(BOOM_IN, userInputMapper->getActionState(UserInputMapper::BOOM_IN)); | 2632 | _myAvatar->setDriveKeys(BOOM_IN, userInputMapper->getActionState(UserInputMapper::BOOM_IN)); |
| 2645 | _myAvatar->setDriveKeys(BOOM_OUT, userInputMapper->getActionState(UserInputMapper::BOOM_OUT)); | 2633 | _myAvatar->setDriveKeys(BOOM_OUT, userInputMapper->getActionState(UserInputMapper::BOOM_OUT)); |
| 2646 | } | 2634 | } |
| 2635 | UserInputMapper::PoseValue leftHand = userInputMapper->getPoseState(UserInputMapper::LEFT_HAND); | ||
| 2636 | UserInputMapper::PoseValue rightHand = userInputMapper->getPoseState(UserInputMapper::RIGHT_HAND); | ||
| 2637 | Hand* hand = DependencyManager::get<AvatarManager>()->getMyAvatar()->getHand(); | ||
| 2638 | setPalmData(hand, leftHand, LEFT_HAND_INDEX); | ||
| 2639 | setPalmData(hand, rightHand, RIGHT_HAND_INDEX); | ||
| 2640 | if (Menu::getInstance()->isOptionChecked(MenuOption::HandMouseInput)) { | ||
| 2641 | emulateMouse(hand, userInputMapper->getActionState(UserInputMapper::LEFT_HAND_CLICK), | ||
| 2642 | userInputMapper->getActionState(UserInputMapper::SHIFT), LEFT_HAND_INDEX); | ||
| 2643 | emulateMouse(hand, userInputMapper->getActionState(UserInputMapper::RIGHT_HAND_CLICK), | ||
| 2644 | userInputMapper->getActionState(UserInputMapper::SHIFT), RIGHT_HAND_INDEX); | ||
| 2645 | } | ||
| 2647 | 2646 | ||
| 2648 | updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process... | 2647 | updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process... |
| 2649 | 2648 | ||
| @@ -2804,6 +2803,7 @@ void Application::setPalmData(Hand* hand, UserInputMapper::PoseValue pose, int i · 154 unmodified lines | |||
| 2804 | if (hand->getPalms()[j].getSixenseID() == index) { | 2803 | if (hand->getPalms()[j].getSixenseID() == index) { |
| 2805 | palm = &(hand->getPalms()[j]); | 2804 | palm = &(hand->getPalms()[j]); |
| 2806 | foundHand = true; | 2805 | foundHand = true; |
| 2806 | break; | ||
| 2807 | } | 2807 | } |
| 2808 | } | 2808 | } |
| 2809 | if (!foundHand) { | 2809 | if (!foundHand) { |
| @@ -2813,11 +2813,7 @@ void Application::setPalmData(Hand* hand, UserInputMapper::PoseValue pose, int i · 3 unmodified lines | |||
| 2813 | palm->setSixenseID(index); | 2813 | palm->setSixenseID(index); |
| 2814 | } | 2814 | } |
| 2815 | 2815 | ||
| 2816 | if (foundHand) { | 2816 | palm->setActive(pose.isValid()); |
| 2817 | palm->setActive(pose.isValid()); | ||
| 2818 | } else { | ||
| 2819 | palm->setActive(false); // if this isn't a Sixsense ID palm, always make it inactive | ||
| 2820 | } | ||
| 2821 | 2817 | ||
| 2822 | // TODO: velocity filters, tip velocities, et.c | 2818 | // TODO: velocity filters, tip velocities, et.c |
| 2823 | // see SixenseManager | 2819 | // see SixenseManager |
| @@ -2843,8 +2839,10 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index) · 19 unmodified lines | |||
| 2843 | if (hand->getPalms()[j].getSixenseID() == index) { | 2839 | if (hand->getPalms()[j].getSixenseID() == index) { |
| 2844 | palm = &(hand->getPalms()[j]); | 2840 | palm = &(hand->getPalms()[j]); |
| 2845 | foundHand = true; | 2841 | foundHand = true; |
| 2842 | break; | ||
| 2846 | } | 2843 | } |
| 2847 | } | 2844 | } |
| 2845 | //qDebug() << "emulateMouse" << !foundHand << !palm->isActive(); | ||
| 2848 | if (!foundHand || !palm->isActive()) { | 2846 | if (!foundHand || !palm->isActive()) { |
| 2849 | return; | 2847 | return; |
| 2850 | } | 2848 | } |
| @@ -2874,6 +2872,8 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index) · 23 unmodified lines | |||
| 2874 | 2872 | ||
| 2875 | } | 2873 | } |
| 2876 | 2874 | ||
| 2875 | //qDebug() << index << " " << click << " " << shift << " " << pos; | ||
| 2876 | |||
| 2877 | //If we are off screen then we should stop processing, and if a trigger or bumper is pressed, | 2877 | //If we are off screen then we should stop processing, and if a trigger or bumper is pressed, |
| 2878 | //we should unpress them. | 2878 | //we should unpress them. |
| 2879 | if (pos.x() == INT_MAX) { | 2879 | if (pos.x() == INT_MAX) { |