From b2e18b529b3b93c61859bce54e42c510c91b704b Mon Sep 17 00:00:00 2001 From: Sam Gondelman Date: Mon, 27 Jul 2015 10:09:59 -0700 Subject: [PATCH 1/3] toggle overlay with mouse middle click, controller 'right click' --- interface/src/Application.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 1e48991969..4f53b85f83 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1707,10 +1707,15 @@ void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) { sendEvent(this, &actionEvent); } else if (event->button() == Qt::RightButton) { - // right click items here + // "right click" on controllers to toggle the overlay + if (deviceID > 0) { + _overlayConductor.setEnabled(!_overlayConductor.getEnabled()); + } } else if (event->button() == Qt::MiddleButton) { - // toggle the overlay - _overlayConductor.setEnabled(!_overlayConductor.getEnabled()); + // mouse middle click to toggle the overlay + if (deviceID == 0) { + _overlayConductor.setEnabled(!_overlayConductor.getEnabled()); + } } } } From 8bbdfd42230e933f505f8e72c714e205dff3d86f Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Mon, 27 Jul 2015 10:53:01 -0700 Subject: [PATCH 2/3] switched vive buttons --- .../src/input-plugins/ViveControllerManager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp b/libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp index caa1f7e1c4..6455b312e0 100644 --- a/libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp +++ b/libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp @@ -388,11 +388,11 @@ void ViveControllerManager::assignDefaultInputMapping(UserInputMapper& mapper) { mapper.addInputChannel(UserInputMapper::VERTICAL_DOWN, makeInput(AXIS_Y_NEG, 1), makeInput(TRACKPAD_BUTTON, 1), JOYSTICK_MOVE_SPEED); // Buttons - mapper.addInputChannel(UserInputMapper::SHIFT, makeInput(GRIP_BUTTON, 0)); - mapper.addInputChannel(UserInputMapper::SHIFT, makeInput(GRIP_BUTTON, 1)); + mapper.addInputChannel(UserInputMapper::SHIFT, makeInput(BUTTON_A, 0)); + mapper.addInputChannel(UserInputMapper::SHIFT, makeInput(BUTTON_A, 1)); - mapper.addInputChannel(UserInputMapper::ACTION1, makeInput(BUTTON_A, 0)); - mapper.addInputChannel(UserInputMapper::ACTION2, makeInput(BUTTON_A, 1)); + mapper.addInputChannel(UserInputMapper::ACTION1, makeInput(GRIP_BUTTON, 0)); + mapper.addInputChannel(UserInputMapper::ACTION2, makeInput(GRIP_BUTTON, 1)); mapper.addInputChannel(UserInputMapper::LEFT_HAND_CLICK, makeInput(TRIGGER_BUTTON, 0)); mapper.addInputChannel(UserInputMapper::RIGHT_HAND_CLICK, makeInput(TRIGGER_BUTTON, 1)); From 50f65b3a54a6fb50ae79d464a6f33850e0aebc87 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Mon, 27 Jul 2015 18:07:21 -0700 Subject: [PATCH 3/3] fixed controller mouse location in standing mode --- interface/src/ui/ApplicationCompositor.cpp | 16 +++++++++------- interface/src/ui/ApplicationCompositor.h | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/interface/src/ui/ApplicationCompositor.cpp b/interface/src/ui/ApplicationCompositor.cpp index 9604c1f0e0..dc75edf905 100644 --- a/interface/src/ui/ApplicationCompositor.cpp +++ b/interface/src/ui/ApplicationCompositor.cpp @@ -243,15 +243,17 @@ void ApplicationCompositor::displayOverlayTexture(RenderArgs* renderArgs) { } -vec2 getPolarCoordinates(const PalmData& palm) { +vec2 ApplicationCompositor::getPolarCoordinates(const PalmData& palm) const { MyAvatar* myAvatar = DependencyManager::get()->getMyAvatar(); - auto avatarOrientation = myAvatar->getOrientation(); - auto eyePos = myAvatar->getDefaultEyePosition(); glm::vec3 tip = myAvatar->getLaserPointerTipPosition(&palm); - // Direction of the tip relative to the eye - glm::vec3 tipDirection = tip - eyePos; - // orient into avatar space - tipDirection = glm::inverse(avatarOrientation) * tipDirection; + glm::vec3 relativePos = myAvatar->getDefaultEyePosition(); + glm::quat rotation = myAvatar->getOrientation(); + if (Menu::getInstance()->isOptionChecked(MenuOption::StandingHMDSensorMode)) { + relativePos = _modelTransform.getTranslation(); + rotation = _modelTransform.getRotation(); + } + glm::vec3 tipDirection = tip - relativePos; + tipDirection = glm::inverse(rotation) * tipDirection; // Normalize for trig functions tipDirection = glm::normalize(tipDirection); // Convert to polar coordinates diff --git a/interface/src/ui/ApplicationCompositor.h b/interface/src/ui/ApplicationCompositor.h index 3074708e70..eef7d9a40b 100644 --- a/interface/src/ui/ApplicationCompositor.h +++ b/interface/src/ui/ApplicationCompositor.h @@ -96,6 +96,8 @@ private: void renderControllerPointers(gpu::Batch& batch); void renderPointersOculus(gpu::Batch& batch); + vec2 getPolarCoordinates(const PalmData& palm) const; + // Support for hovering and tooltips static EntityItemID _noItemId; EntityItemID _hoverItemId { _noItemId };