From 1b064a0ebebbcaf370d314a851528da797429cba Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Thu, 26 Sep 2019 14:29:01 -0700 Subject: [PATCH] Fix Q key on first person cam. Let camera control flying Y axis --- interface/resources/controllers/keyboardMouse.json | 2 +- interface/src/avatar/MyAvatar.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/interface/resources/controllers/keyboardMouse.json b/interface/resources/controllers/keyboardMouse.json index ff02142891..0e80709f9c 100644 --- a/interface/resources/controllers/keyboardMouse.json +++ b/interface/resources/controllers/keyboardMouse.json @@ -4,7 +4,7 @@ { "from": "Keyboard.A", "when": ["Keyboard.RightMouseButton", "!Keyboard.Control"], "to": "Actions.LATERAL_LEFT" }, { "from": "Keyboard.D", "when": ["Keyboard.RightMouseButton", "!Keyboard.Control"], "to": "Actions.LATERAL_RIGHT" }, { "from": "Keyboard.E", "when": ["!Application.CameraSelfie", "!Application.CameraLookAt", "!Keyboard.Control"], "to": "Actions.LATERAL_RIGHT" }, - { "from": "Keyboard.Q", "when": ["!Application.CameraSelfie"," !Application.CameraLookAt", "!Keyboard.Control"], "to": "Actions.LATERAL_LEFT" }, + { "from": "Keyboard.Q", "when": ["!Application.CameraSelfie", "!Application.CameraLookAt", "!Keyboard.Control"], "to": "Actions.LATERAL_LEFT" }, { "from": "Keyboard.T", "when": "!Keyboard.Control", "to": "Actions.TogglePushToTalk" }, { "comment" : "Mouse turn need to be small continuous increments", diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 6f16e6e1bf..518aa4fe2c 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -2709,7 +2709,11 @@ void MyAvatar::updateMotors() { if (_motionBehaviors & AVATAR_MOTION_ACTION_MOTOR_ENABLED) { if (_characterController.getState() == CharacterController::State::Hover || _characterController.computeCollisionMask() == BULLET_COLLISION_MASK_COLLISIONLESS) { - motorRotation = getMyHead()->getHeadOrientation(); + if (qApp->getCamera().getMode() == CAMERA_MODE_LOOK_AT || qApp->getCamera().getMode() == CAMERA_MODE_SELFIE) { + motorRotation = getLookAtRotation(); + } else { + motorRotation = getMyHead()->getHeadOrientation(); + } } else { // non-hovering = walking: follow camera twist about vertical but not lift // we decompose camera's rotation and store the twist part in motorRotation @@ -3632,8 +3636,7 @@ void MyAvatar::updateOrientation(float deltaTime) { glm::vec3 targetPoint = eyesPosition + glm::normalize(cameraVector); const float LOOKAT_MIX_ALPHA = 0.25f; - - if (getDriveKey(TRANSLATE_Y) == 0.0f) { + if (!isFlying() || !hasDriveInput()) { // Approximate the head's look at vector to the camera look at vector with some delay. float mixAlpha = LOOKAT_MIX_ALPHA * timeScale; if (mixAlpha > 1.0f) {