mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 02:36:54 +02:00
fixing some issues
This commit is contained in:
parent
272f71b940
commit
1079cfb264
2 changed files with 41 additions and 20 deletions
|
@ -72,11 +72,6 @@
|
||||||
"when": "Application.CameraThirdPerson",
|
"when": "Application.CameraThirdPerson",
|
||||||
"to": "Actions.Yaw"
|
"to": "Actions.Yaw"
|
||||||
},
|
},
|
||||||
{ "from": { "makeAxis" : [ ["Keyboard.A"], ["Keyboard.D"] ] },
|
|
||||||
"when": "Application.CameraFSM",
|
|
||||||
"to": "Actions.Yaw"
|
|
||||||
},
|
|
||||||
|
|
||||||
{ "from": { "makeAxis" : ["Keyboard.MouseMoveLeft", "Keyboard.MouseMoveRight"] },
|
{ "from": { "makeAxis" : ["Keyboard.MouseMoveLeft", "Keyboard.MouseMoveRight"] },
|
||||||
"when": "Keyboard.RightMouseButton",
|
"when": "Keyboard.RightMouseButton",
|
||||||
"to": "Actions.Yaw",
|
"to": "Actions.Yaw",
|
||||||
|
|
|
@ -2789,22 +2789,48 @@ void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {
|
||||||
}
|
}
|
||||||
else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
|
else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
|
||||||
_thirdPersonHMDCameraBoomValid= false;
|
_thirdPersonHMDCameraBoomValid= false;
|
||||||
auto userInputMapper = DependencyManager::get<UserInputMapper>();
|
|
||||||
const float YAW_SPEED = 70.0f;
|
if (isHMDMode()) {
|
||||||
float targetSpeed = userInputMapper->getActionState(controller::Action::YAW) * YAW_SPEED;
|
auto mirrorBodyOrientation = myAvatar->getWorldOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f));
|
||||||
if (targetSpeed != 0.0f) {
|
|
||||||
const float ROTATION_TIMESCALE = 20.0f;
|
glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix());
|
||||||
float blend = deltaTime / ROTATION_TIMESCALE;
|
// Mirror HMD yaw and roll
|
||||||
if (blend > 1.0f) {
|
glm::vec3 mirrorHmdEulers = glm::eulerAngles(hmdRotation);
|
||||||
blend = 1.0f;
|
mirrorHmdEulers.y = -mirrorHmdEulers.y;
|
||||||
}
|
mirrorHmdEulers.z = -mirrorHmdEulers.z;
|
||||||
_rotateMirror = (1.0f - blend) * _rotateMirror + blend * targetSpeed;
|
glm::quat mirrorHmdRotation = glm::quat(mirrorHmdEulers);
|
||||||
|
|
||||||
|
glm::quat worldMirrorRotation = mirrorBodyOrientation * mirrorHmdRotation;
|
||||||
|
|
||||||
|
_myCamera.setOrientation(worldMirrorRotation);
|
||||||
|
|
||||||
|
glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix());
|
||||||
|
// Mirror HMD lateral offsets
|
||||||
|
hmdOffset.x = -hmdOffset.x;
|
||||||
|
|
||||||
|
_myCamera.setPosition(myAvatar->getDefaultEyePosition()
|
||||||
|
+ glm::vec3(0, _raiseMirror * myAvatar->getModelScale(), 0)
|
||||||
|
+ mirrorBodyOrientation * glm::vec3(0.0f, 0.0f, 1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror
|
||||||
|
+ mirrorBodyOrientation * hmdOffset);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
auto userInputMapper = DependencyManager::get<UserInputMapper>();
|
||||||
|
const float YAW_SPEED = 70.0f;
|
||||||
|
float targetSpeed = userInputMapper->getActionState(controller::Action::YAW) * YAW_SPEED;
|
||||||
|
if (targetSpeed != 0.0f) {
|
||||||
|
const float ROTATION_TIMESCALE = 20.0f;
|
||||||
|
float blend = deltaTime / ROTATION_TIMESCALE;
|
||||||
|
if (blend > 1.0f) {
|
||||||
|
blend = 1.0f;
|
||||||
|
}
|
||||||
|
_rotateMirror = (1.0f - blend) * _rotateMirror + blend * targetSpeed;
|
||||||
|
}
|
||||||
|
_myCamera.setOrientation(glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
|
||||||
|
_myCamera.setPosition(myAvatar->getDefaultEyePosition()
|
||||||
|
+ glm::vec3(0, _raiseMirror * myAvatar->getModelScale(), 0)
|
||||||
|
+ (glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) *
|
||||||
|
glm::vec3(0.0f, 0.0f, -1.0f) * myAvatar->getBoomLength() * _scaleMirror);
|
||||||
}
|
}
|
||||||
_myCamera.setOrientation(glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
|
|
||||||
_myCamera.setPosition(myAvatar->getDefaultEyePosition()
|
|
||||||
+ glm::vec3(0, _raiseMirror * myAvatar->getModelScale(), 0)
|
|
||||||
+ (glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) *
|
|
||||||
glm::vec3(0.0f, 0.0f, -1.0f) * myAvatar->getBoomLength() * _scaleMirror);
|
|
||||||
renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE;
|
renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE;
|
||||||
}
|
}
|
||||||
else if (_myCamera.getMode() == CAMERA_MODE_ENTITY) {
|
else if (_myCamera.getMode() == CAMERA_MODE_ENTITY) {
|
||||||
|
|
Loading…
Reference in a new issue