mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Merge pull request #5440 from SamGondelman/sam/input-plugins
Various input plugins fixes
This commit is contained in:
commit
de446fe91e
4 changed files with 23 additions and 14 deletions
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<AvatarManager>()->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
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue