mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
fix stuck drive keys for Avatar when modifier released
This commit is contained in:
parent
0e4de53c99
commit
de24842cf0
3 changed files with 17 additions and 3 deletions
|
@ -905,7 +905,9 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
|||
break;
|
||||
|
||||
case Qt::Key_D:
|
||||
_myAvatar->setDriveKeys(ROT_RIGHT, 1.f);
|
||||
if (!isMeta) {
|
||||
_myAvatar->setDriveKeys(ROT_RIGHT, 1.f);
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_Return:
|
||||
|
@ -1073,7 +1075,7 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
|
|||
_keysPressed.remove(event->key());
|
||||
|
||||
_controllerScriptingInterface.emitKeyReleaseEvent(event); // send events to any registered scripts
|
||||
|
||||
|
||||
// if one of our scripts have asked to capture this event, then stop processing it
|
||||
if (_controllerScriptingInterface.isKeyCaptured(event)) {
|
||||
return;
|
||||
|
@ -1125,7 +1127,12 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
|
|||
_myAvatar->setDriveKeys(RIGHT, 0.f);
|
||||
_myAvatar->setDriveKeys(ROT_RIGHT, 0.f);
|
||||
break;
|
||||
|
||||
case Qt::Key_Control:
|
||||
case Qt::Key_Shift:
|
||||
case Qt::Key_Meta:
|
||||
case Qt::Key_Alt:
|
||||
_myAvatar->clearDriveKeys();
|
||||
break;
|
||||
default:
|
||||
event->ignore();
|
||||
break;
|
||||
|
|
|
@ -1972,3 +1972,9 @@ glm::vec3 MyAvatar::getLaserPointerTipPosition(const PalmData* palm) {
|
|||
|
||||
return palm->getPosition();
|
||||
}
|
||||
|
||||
void MyAvatar::clearDriveKeys() {
|
||||
for (int i = 0; i < sizeof(_driveKeys); i++) {
|
||||
_driveKeys[i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,6 +98,7 @@ public:
|
|||
AttachmentData loadAttachmentData(const QUrl& modelURL, const QString& jointName = QString()) const;
|
||||
|
||||
// Set what driving keys are being pressed to control thrust levels
|
||||
void clearDriveKeys();
|
||||
void setDriveKeys(int key, float val) { _driveKeys[key] = val; };
|
||||
bool getDriveKeys(int key) { return _driveKeys[key] != 0.f; };
|
||||
void jump() { _shouldJump = true; };
|
||||
|
|
Loading…
Reference in a new issue