mirror of
https://github.com/lubosz/overte.git
synced 2025-04-14 05:26:16 +02:00
Solved some sitting and sound issues while looking at
This commit is contained in:
parent
1054e8fcde
commit
7bc8e6b237
5 changed files with 51 additions and 55 deletions
|
@ -3,8 +3,8 @@
|
|||
"channels": [
|
||||
{ "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.CameraLookAt", "!Keyboard.Control"], "to": "Actions.LATERAL_RIGHT" },
|
||||
{ "from": "Keyboard.Q", "when": ["!Application.CameraLookAt", "!Keyboard.Control"], "to": "Actions.LATERAL_LEFT" },
|
||||
{ "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.T", "when": "!Keyboard.Control", "to": "Actions.TogglePushToTalk" },
|
||||
|
||||
{ "comment" : "Mouse turn need to be small continuous increments",
|
||||
|
@ -131,8 +131,8 @@
|
|||
},
|
||||
|
||||
{ "from": { "makeAxis" : [
|
||||
["Keyboard.A"],
|
||||
["Keyboard.D"]
|
||||
["Keyboard.E"],
|
||||
["Keyboard.Q"]
|
||||
]
|
||||
},
|
||||
"when": ["Application.CameraSelfie", "!Keyboard.Control"],
|
||||
|
@ -185,7 +185,7 @@
|
|||
},
|
||||
|
||||
{ "from": { "makeAxis" : ["Keyboard.MouseMoveUp", "Keyboard.MouseMoveDown"] },
|
||||
"when": ["!Application.CameraSelfie", "Keyboard.RightMouseButton"],
|
||||
"when": ["!Application.CameraSelfie", "!Application.CameraLookAt", "Keyboard.RightMouseButton"],
|
||||
"to": "Actions.DeltaPitch",
|
||||
"filters":
|
||||
[
|
||||
|
@ -193,19 +193,32 @@
|
|||
]
|
||||
},
|
||||
|
||||
{ "from": { "makeAxis" : ["Keyboard.MouseMoveUp", "Keyboard.MouseMoveDown"] },
|
||||
"when": ["Application.CameraLookAt", "Keyboard.RightMouseButton"],
|
||||
"to": "Actions.DeltaPitch",
|
||||
"filters":
|
||||
[
|
||||
{ "type": "scale", "scale": 0.3 }
|
||||
]
|
||||
},
|
||||
|
||||
{ "from": { "makeAxis" : ["Keyboard.MouseMoveDown", "Keyboard.MouseMoveUp"] },
|
||||
"when": ["Application.CameraSelfie", "Keyboard.RightMouseButton"],
|
||||
"to": "Actions.DeltaPitch",
|
||||
"filters":
|
||||
[
|
||||
{ "type": "scale", "scale": 0.6 }
|
||||
{ "type": "scale", "scale": 0.3 }
|
||||
]
|
||||
},
|
||||
|
||||
{ "from": "Keyboard.W", "when": "!Keyboard.Control", "to": "Actions.LONGITUDINAL_FORWARD" },
|
||||
{ "from": "Keyboard.S", "when": "!Keyboard.Control", "to": "Actions.LONGITUDINAL_BACKWARD" },
|
||||
{ "from": "Keyboard.W", "when": ["!Application.CameraSelfie", "!Keyboard.Control"], "to": "Actions.LONGITUDINAL_FORWARD" },
|
||||
{ "from": "Keyboard.S", "when": ["!Application.CameraSelfie", "!Keyboard.Control"], "to": "Actions.LONGITUDINAL_BACKWARD" },
|
||||
{ "from": "Keyboard.S", "when": ["Application.CameraSelfie", "!Keyboard.Control"], "to": "Actions.LONGITUDINAL_FORWARD" },
|
||||
{ "from": "Keyboard.W", "when": ["Application.CameraSelfie", "!Keyboard.Control"], "to": "Actions.LONGITUDINAL_BACKWARD" },
|
||||
{ "from": "Keyboard.A", "when": "Application.CameraLookAt", "to": "Actions.LATERAL_LEFT" },
|
||||
{ "from": "Keyboard.D", "when": "Application.CameraLookAt", "to": "Actions.LATERAL_RIGHT" },
|
||||
{ "from": "Keyboard.A", "when": "Application.CameraSelfie", "to": "Actions.LATERAL_RIGHT" },
|
||||
{ "from": "Keyboard.D", "when": "Application.CameraSelfie", "to": "Actions.LATERAL_LEFT" },
|
||||
{ "from": "Keyboard.Shift", "when": ["!Keyboard.Left", "!Keyboard.Right"], "to": "Actions.SPRINT" },
|
||||
{ "from": "Keyboard.C", "when": "!Keyboard.Control", "to": "Actions.VERTICAL_DOWN" },
|
||||
{ "from": "Keyboard.Left", "when": "Keyboard.Shift", "to": "Actions.LATERAL_LEFT" },
|
||||
|
|
|
@ -4418,11 +4418,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
|||
menu->triggerOption(MenuOption::LookAtScreen);
|
||||
break;
|
||||
}
|
||||
case Qt::Key_4: {
|
||||
Menu* menu = Menu::getInstance();
|
||||
menu->triggerOption(MenuOption::FullscreenMirror);
|
||||
break;
|
||||
}
|
||||
case Qt::Key_4:
|
||||
case Qt::Key_5:
|
||||
case Qt::Key_6:
|
||||
case Qt::Key_7:
|
||||
|
@ -6008,9 +6004,6 @@ void Application::cameraModeChanged() {
|
|||
case CAMERA_MODE_SELFIE:
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::SelfieScreen, true);
|
||||
break;
|
||||
case CAMERA_MODE_MIRROR:
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FullscreenMirror, true);
|
||||
break;
|
||||
default:
|
||||
// we don't have menu items for the others, so just leave it alone.
|
||||
return;
|
||||
|
@ -6025,25 +6018,18 @@ void Application::changeViewAsNeeded(float boomLength) {
|
|||
|
||||
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON && boomLengthGreaterThanMinimum) {
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, false);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, true);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::LookAtScreen, true);
|
||||
cameraMenuChanged();
|
||||
} else if (_myCamera.getMode() == CAMERA_MODE_LOOK_AT && !boomLengthGreaterThanMinimum) {
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, true);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, false);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::LookAtScreen, false);
|
||||
cameraMenuChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::cameraMenuChanged() {
|
||||
auto menu = Menu::getInstance();
|
||||
if (menu->isOptionChecked(MenuOption::FullscreenMirror)) {
|
||||
if (!isHMDMode() && _myCamera.getMode() != CAMERA_MODE_MIRROR) {
|
||||
_mirrorYawOffset = 0.0f;
|
||||
_myCamera.setMode(CAMERA_MODE_MIRROR);
|
||||
getMyAvatar()->reset(false, false, false); // to reset any active MyAvatar::FollowHelpers
|
||||
getMyAvatar()->setBoomLength(MyAvatar::ZOOM_DEFAULT);
|
||||
}
|
||||
} else if (menu->isOptionChecked(MenuOption::FirstPerson)) {
|
||||
if (menu->isOptionChecked(MenuOption::FirstPerson)) {
|
||||
if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) {
|
||||
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
|
||||
getMyAvatar()->setBoomLength(MyAvatar::ZOOM_MIN);
|
||||
|
@ -9145,9 +9131,7 @@ void Application::setDisplayPlugin(DisplayPluginPointer newDisplayPlugin) {
|
|||
cameraMenuChanged();
|
||||
}
|
||||
|
||||
// Remove the mirror and selfie camera options from menu if in HMD mode
|
||||
auto mirrorAction = menu->getActionForOption(MenuOption::FullscreenMirror);
|
||||
mirrorAction->setVisible(!isHmd);
|
||||
// Remove the selfie camera options from menu if in HMD mode
|
||||
auto selfieAction = menu->getActionForOption(MenuOption::SelfieScreen);
|
||||
selfieAction->setVisible(!isHmd);
|
||||
}
|
||||
|
|
|
@ -191,13 +191,6 @@ Menu::Menu() {
|
|||
|
||||
selfieAction->setProperty(EXCLUSION_GROUP_KEY, QVariant::fromValue(cameraModeGroup));
|
||||
|
||||
// View > Mirror
|
||||
auto viewMirrorAction = cameraModeGroup->addAction(addCheckableActionToQMenuAndActionHash(
|
||||
viewMenu, MenuOption::FullscreenMirror, 0,
|
||||
false, qApp, SLOT(cameraMenuChanged())));
|
||||
|
||||
viewMirrorAction->setProperty(EXCLUSION_GROUP_KEY, QVariant::fromValue(cameraModeGroup));
|
||||
|
||||
viewMenu->addSeparator();
|
||||
|
||||
// View > Center Player In View
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace MenuOption {
|
|||
const QString Login = "Login/Sign Up";
|
||||
const QString Log = "Log";
|
||||
const QString LogExtraTimings = "Log Extra Timing Details";
|
||||
const QString LookAtScreen = "Look At";
|
||||
const QString LookAtScreen = "Third Person";
|
||||
const QString LowVelocityFilter = "Low Velocity Filter";
|
||||
const QString MeshVisible = "Draw Mesh";
|
||||
const QString MuteEnvironment = "Mute Environment";
|
||||
|
@ -201,7 +201,7 @@ namespace MenuOption {
|
|||
const QString AnimStats = "Show Animation Stats";
|
||||
const QString StopAllScripts = "Stop All Scripts";
|
||||
const QString SuppressShortTimings = "Suppress Timings Less than 10ms";
|
||||
const QString ThirdPerson = "Third Person";
|
||||
const QString ThirdPerson = "Third Person Legacy";
|
||||
const QString ThreePointCalibration = "3 Point Calibration";
|
||||
const QString ThrottleFPSIfNotFocus = "Throttle FPS If Not Focus"; // FIXME - this value duplicated in Basic2DWindowOpenGLDisplayPlugin.cpp
|
||||
const QString ToggleHipsFollowing = "Toggle Hips Following";
|
||||
|
|
|
@ -3333,10 +3333,10 @@ void MyAvatar::setRotationThreshold(float angleRadians) {
|
|||
void MyAvatar::updateOrientation(float deltaTime) {
|
||||
// Smoothly rotate body with arrow keys
|
||||
float targetSpeed = getDriveKey(YAW) * _yawSpeed;
|
||||
bool computeCameraLookAt = (qApp->getCamera().getMode() == CAMERA_MODE_LOOK_AT ||
|
||||
qApp->getCamera().getMode() == CAMERA_MODE_SELFIE) && isReadyForPhysics();
|
||||
if (computeCameraLookAt) {
|
||||
// Rotate directly proportional to delta yaw and delta pitch from right-click mouse movement.
|
||||
bool computeLookAt = (qApp->getCamera().getMode() == CAMERA_MODE_LOOK_AT ||
|
||||
qApp->getCamera().getMode() == CAMERA_MODE_SELFIE) && isReadyForPhysics();
|
||||
if (computeLookAt) {
|
||||
// For "Look At" and "Selfie" camera modes we also smooth the yaw rotation from right-click mouse movement.
|
||||
float speedFromDeltaYaw = deltaTime > FLT_EPSILON ? getDriveKey(DELTA_YAW) / deltaTime : 0.0f;
|
||||
speedFromDeltaYaw *= _yawSpeed / YAW_SPEED_DEFAULT;
|
||||
targetSpeed += speedFromDeltaYaw;
|
||||
|
@ -3364,7 +3364,8 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
}
|
||||
}
|
||||
float totalBodyYaw = _bodyYawDelta * deltaTime;
|
||||
if (!computeCameraLookAt) {
|
||||
if (!computeLookAt) {
|
||||
// Rotate directly proportional to delta yaw and delta pitch from right-click mouse movement.
|
||||
totalBodyYaw += getDriveKey(DELTA_YAW) * _yawSpeed / YAW_SPEED_DEFAULT;
|
||||
}
|
||||
// Comfort Mode: If you press any of the left/right rotation drive keys or input, you'll
|
||||
|
@ -3414,7 +3415,7 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
float timeScale = deltaTime * FPS;
|
||||
|
||||
bool faceForward = false;
|
||||
if (!computeCameraLookAt) {
|
||||
if (!computeLookAt) {
|
||||
setWorldOrientation(getWorldOrientation() * glm::quat(glm::radians(glm::vec3(0.0f, totalBodyYaw, 0.0f))));
|
||||
_lookAtCameraTarget = eyesPosition + getWorldOrientation() * Vectors::FRONT;
|
||||
_lookAtOffsetYaw = getWorldOrientation();
|
||||
|
@ -3439,7 +3440,8 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
}
|
||||
bool isMovingFwdBwd = getDriveKey(TRANSLATE_Z) != 0.0f;
|
||||
bool isMovingSideways = getDriveKey(TRANSLATE_X) != 0.0f;
|
||||
faceForward = computeCameraLookAt && (isMovingFwdBwd || isMovingSideways);
|
||||
bool isRotatingWhileSeated = isMovingSideways && _characterController.getSeated();
|
||||
faceForward = isMovingFwdBwd || (isMovingSideways && !isRotatingWhileSeated);
|
||||
// Blend the avatar orientation with the camera look at if moving forward.
|
||||
if (faceForward || _shouldTurnToFaceCamera) {
|
||||
const float REORIENT_FORWARD_BLEND = 0.25f;
|
||||
|
@ -3453,13 +3455,14 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
if (isMovingFwdBwd && isMovingSideways) {
|
||||
// Reorient avatar to face camera diagonal
|
||||
blend = DIAGONAL_TURN_BLEND;
|
||||
if (getDriveKey(TRANSLATE_X) > 0.0f) {
|
||||
faceRotation = _lookAtOffsetYaw * glm::angleAxis(-0.25f * PI, Vectors::UP);
|
||||
} else if (getDriveKey(TRANSLATE_X) < 0.0f) {
|
||||
faceRotation = _lookAtOffsetYaw * glm::angleAxis(0.25f * PI, Vectors::UP);
|
||||
}
|
||||
float turnSign = getDriveKey(TRANSLATE_Z) < 0.0f ? -1.0f : 1.0f;
|
||||
turnSign = getDriveKey(TRANSLATE_X) > 0.0f ? -turnSign : turnSign;
|
||||
faceRotation = _lookAtOffsetYaw * glm::angleAxis(turnSign * 0.25f * PI, Vectors::UP);
|
||||
}
|
||||
setWorldOrientation(glm::slerp(getWorldOrientation(), faceRotation, blend));
|
||||
} else if (isRotatingWhileSeated) {
|
||||
float rotatingWhileSeatedYaw = -getDriveKey(TRANSLATE_X) * _yawSpeed * deltaTime;
|
||||
setWorldOrientation(getWorldOrientation() * glm::quat(glm::radians(glm::vec3(0.0f, rotatingWhileSeatedYaw, 0.0f))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3482,7 +3485,7 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
head->setBaseYaw(YAW(euler));
|
||||
head->setBasePitch(PITCH(euler));
|
||||
head->setBaseRoll(ROLL(euler));
|
||||
} else if (computeCameraLookAt) {
|
||||
} else if (computeLookAt) {
|
||||
// Reset head orientation before applying the blending offset
|
||||
head->setBaseYaw(0.0f);
|
||||
head->setBasePitch(0.0f);
|
||||
|
@ -3582,7 +3585,7 @@ float MyAvatar::calculateGearedSpeed(const float driveKey) {
|
|||
glm::vec3 MyAvatar::scaleMotorSpeed(const glm::vec3 forward, const glm::vec3 right) {
|
||||
float stickFullOn = 0.85f;
|
||||
auto zSpeed = getDriveKey(TRANSLATE_Z);
|
||||
auto xSpeed = getDriveKey(TRANSLATE_X);
|
||||
auto xSpeed = !_characterController.getSeated() ? getDriveKey(TRANSLATE_X) : 0.0f;
|
||||
glm::vec3 direction;
|
||||
if (!useAdvancedMovementControls() && qApp->isHMDMode()) {
|
||||
// Walking disabled in settings.
|
||||
|
@ -5272,9 +5275,13 @@ glm::quat MyAvatar::getOrientationForAudio() {
|
|||
glm::quat result;
|
||||
|
||||
switch (_audioListenerMode) {
|
||||
case AudioListenerMode::FROM_HEAD:
|
||||
result = getHead()->getFinalOrientationInWorldFrame();
|
||||
case AudioListenerMode::FROM_HEAD: {
|
||||
// Compute the head orientation if we are using the look at blending
|
||||
CameraMode mode = qApp->getCamera().getMode();
|
||||
bool headFollowsCamera = mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_SELFIE;
|
||||
result = headFollowsCamera ? qApp->getCamera().getOrientation() : getHead()->getFinalOrientationInWorldFrame();
|
||||
break;
|
||||
}
|
||||
case AudioListenerMode::FROM_CAMERA:
|
||||
result = qApp->getCamera().getOrientation();
|
||||
break;
|
||||
|
@ -6400,7 +6407,6 @@ void MyAvatar::sendPacket(const QUuid& entityID) const {
|
|||
|
||||
void MyAvatar::setSitDriveKeysStatus(bool enabled) {
|
||||
const std::vector<DriveKeys> DISABLED_DRIVE_KEYS_DURING_SIT = {
|
||||
DriveKeys::TRANSLATE_X,
|
||||
DriveKeys::TRANSLATE_Y,
|
||||
DriveKeys::TRANSLATE_Z,
|
||||
DriveKeys::STEP_TRANSLATE_X,
|
||||
|
|
Loading…
Reference in a new issue