diff --git a/interface/resources/config/keyboard.json b/interface/resources/config/keyboard.json index 186a9c1084..b3688ef06e 100644 --- a/interface/resources/config/keyboard.json +++ b/interface/resources/config/keyboard.json @@ -701,9 +701,9 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.53203323516845703, + "x": -0.59333323516845703, "y": 0.019300000742077827, - "z": -0.07286686894893646 + "z": 0.037454843521118164 }, "modelURL": "meshes/keyboard/SM_key.fbx", "texture": { @@ -752,7 +752,7 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.59333323516845703, + "x": -0.65333323516845703, "y": 0.019300000742077827, "z": 0.037454843521118164 }, @@ -777,9 +777,9 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.5103323516845703, - "y": 0.019300000742077827, - "z": -0.127054843521118164 + "x": -0.5503323516845703, + "y": 0.019300000742077827, + "z": -0.07282185554504395 }, "modelURL": "meshes/keyboard/SM_enter.fbx", "texture": { @@ -1479,9 +1479,9 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.53203323516845703, + "x": -0.59333323516845703, "y": 0.019300000742077827, - "z": -0.07286686894893646 + "z": 0.037454843521118164 }, "modelURL": "meshes/keyboard/SM_key.fbx", "texture": { @@ -1530,7 +1530,7 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.59333323516845703, + "x": -0.65333323516845703, "y": 0.019300000742077827, "z": 0.037454843521118164 }, @@ -1555,9 +1555,9 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.5103323516845703, - "y": 0.019300000742077827, - "z": -0.127054843521118164 + "x": -0.5503323516845703, + "y": 0.019300000742077827, + "z": -0.07282185554504395 }, "modelURL": "meshes/keyboard/SM_enter.fbx", "texture": { @@ -2305,9 +2305,9 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.53203323516845703, + "x": -0.59333323516845703, "y": 0.019300000742077827, - "z": -0.07286686894893646 + "z": 0.037454843521118164 }, "modelURL": "meshes/keyboard/SM_key.fbx", "texture": { @@ -2356,7 +2356,7 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.59333323516845703, + "x": -0.65333323516845703, "y": 0.019300000742077827, "z": 0.037454843521118164 }, @@ -2381,9 +2381,9 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.5103323516845703, - "y": 0.019300000742077827, - "z": -0.127054843521118164 + "x": -0.5503323516845703, + "y": 0.019300000742077827, + "z": -0.07282185554504395 }, "modelURL": "meshes/keyboard/SM_enter.fbx", "texture": { diff --git a/interface/resources/meshes/drumstick.fbx b/interface/resources/meshes/drumstick.fbx index 0243d9fd1b..b384e6a30a 100644 Binary files a/interface/resources/meshes/drumstick.fbx and b/interface/resources/meshes/drumstick.fbx differ diff --git a/interface/resources/sounds/keyboardPress.mp3 b/interface/resources/sounds/keyboardPress.mp3 new file mode 100644 index 0000000000..e4cd21b971 Binary files /dev/null and b/interface/resources/sounds/keyboardPress.mp3 differ diff --git a/interface/resources/sounds/keyboard_key.mp3 b/interface/resources/sounds/keyboard_key.mp3 deleted file mode 100644 index e2cec81032..0000000000 Binary files a/interface/resources/sounds/keyboard_key.mp3 and /dev/null differ diff --git a/interface/src/ui/Keyboard.cpp b/interface/src/ui/Keyboard.cpp index 5f83c095c8..6852691634 100644 --- a/interface/src/ui/Keyboard.cpp +++ b/interface/src/ui/Keyboard.cpp @@ -45,6 +45,7 @@ #include "scripting/HMDScriptingInterface.h" #include "scripting/WindowScriptingInterface.h" #include "scripting/SelectionScriptingInterface.h" +#include "scripting/HMDScriptingInterface.h" #include "DependencyManager.h" #include "raypick/StylusPointer.h" @@ -54,9 +55,9 @@ static const int LEFT_HAND_CONTROLLER_INDEX = 0; static const int RIGHT_HAND_CONTROLLER_INDEX = 1; -static const float MALLET_LENGTH = 0.2f; -static const float MALLET_TOUCH_Y_OFFSET = 0.052f; -static const float MALLET_Y_OFFSET = 0.180f; +static const float MALLET_LENGTH = 0.18f; +static const float MALLET_TOUCH_Y_OFFSET = 0.050f; +static const float MALLET_Y_OFFSET = 0.160f; static const glm::quat MALLET_ROTATION_OFFSET{0.70710678f, 0.0f, -0.70710678f, 0.0f}; static const glm::vec3 MALLET_MODEL_DIMENSIONS{0.03f, MALLET_LENGTH, 0.03f}; @@ -65,14 +66,14 @@ static const glm::vec3 MALLET_TIP_OFFSET{0.0f, MALLET_LENGTH - MALLET_TOUCH_Y_OF static const glm::vec3 Z_AXIS {0.0f, 0.0f, 1.0f}; -static const glm::vec3 KEYBOARD_TABLET_OFFSET{0.28f, -0.3f, -0.05f}; +static const glm::vec3 KEYBOARD_TABLET_OFFSET{0.30f, -0.38f, -0.04f}; static const glm::vec3 KEYBOARD_TABLET_DEGREES_OFFSET{-45.0f, 0.0f, 0.0f}; static const glm::vec3 KEYBOARD_TABLET_LANDSCAPE_OFFSET{-0.2f, -0.27f, -0.05f}; static const glm::vec3 KEYBOARD_TABLET_LANDSCAPE_DEGREES_OFFSET{-45.0f, 0.0f, -90.0f}; static const glm::vec3 KEYBOARD_AVATAR_OFFSET{-0.6f, 0.3f, -0.7f}; static const glm::vec3 KEYBOARD_AVATAR_DEGREES_OFFSET{0.0f, 180.0f, 0.0f}; -static const QString SOUND_FILE = PathUtils::resourcesUrl() + "sounds/keyboard_key.mp3"; +static const QString SOUND_FILE = PathUtils::resourcesUrl() + "sounds/keyboardPress.mp3"; static const QString MALLET_MODEL_URL = PathUtils::resourcesUrl() + "meshes/drumstick.fbx"; static const float PULSE_STRENGTH = 0.6f; @@ -221,6 +222,7 @@ Keyboard::Keyboard() { auto pointerManager = DependencyManager::get(); auto windowScriptingInterface = DependencyManager::get(); auto myAvatar = DependencyManager::get()->getMyAvatar(); + auto hmdScriptingInterface = DependencyManager::get(); connect(pointerManager.data(), &PointerManager::triggerBeginOverlay, this, &Keyboard::handleTriggerBegin, Qt::QueuedConnection); connect(pointerManager.data(), &PointerManager::triggerContinueOverlay, this, &Keyboard::handleTriggerContinue, Qt::QueuedConnection); connect(pointerManager.data(), &PointerManager::triggerEndOverlay, this, &Keyboard::handleTriggerEnd, Qt::QueuedConnection); @@ -228,6 +230,7 @@ Keyboard::Keyboard() { connect(pointerManager.data(), &PointerManager::hoverEndOverlay, this, &Keyboard::handleHoverEnd, Qt::QueuedConnection); connect(myAvatar.get(), &MyAvatar::sensorToWorldScaleChanged, this, &Keyboard::scaleKeyboard, Qt::QueuedConnection); connect(windowScriptingInterface.data(), &WindowScriptingInterface::domainChanged, [&]() { setRaised(false); }); + connect(hmdScriptingInterface.data(), &HMDScriptingInterface::displayModeChanged, [&]() { setRaised(false); }); } void Keyboard::registerKeyboardHighlighting() { @@ -483,7 +486,7 @@ void Keyboard::handleTriggerBegin(const OverlayID& overlayID, const PointerEvent AudioInjectorOptions audioOptions; audioOptions.localOnly = true; audioOptions.position = keyWorldPosition; - audioOptions.volume = 0.1f; + audioOptions.volume = 0.05f; AudioInjector::playSoundAndDelete(_keySound, audioOptions); @@ -835,8 +838,8 @@ void Keyboard::loadKeyboardFile(const QString& keyboardFile) { _textDisplay = textDisplay; _ignoreItemsLock.withWriteLock([&] { - _itemsToIgnore.push_back(_textDisplay.overlayID); - _itemsToIgnore.push_back(_anchor.overlayID); + _itemsToIgnore.append(_textDisplay.overlayID); + _itemsToIgnore.append(_anchor.overlayID); }); _layerIndex = 0; auto pointerManager = DependencyManager::get(); diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 7593e12e07..22b123c85d 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -535,7 +535,7 @@ RayToOverlayIntersectionResult Overlays::findRayIntersectionVector(const PickRay bool bestIsFront = false; bool bestIsTablet = false; auto tabletIDs = qApp->getTabletIDs(); - + const QVector keyboardKeysToDiscard = DependencyManager::get()->getKeysID(); QMutexLocker locker(&_mutex); RayToOverlayIntersectionResult result; QMapIterator i(_overlaysWorld); @@ -545,7 +545,8 @@ RayToOverlayIntersectionResult Overlays::findRayIntersectionVector(const PickRay auto thisOverlay = std::dynamic_pointer_cast(i.value()); if ((overlaysToDiscard.size() > 0 && overlaysToDiscard.contains(thisID)) || - (overlaysToInclude.size() > 0 && !overlaysToInclude.contains(thisID))) { + (overlaysToInclude.size() > 0 && !overlaysToInclude.contains(thisID)) || + (keyboardKeysToDiscard.size() > 0 && keyboardKeysToDiscard.contains(thisID))) { continue; }