mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-20 17:51:19 -05:00
Solve bug for when tilting the camera.
This commit is contained in:
@@ -792,11 +792,14 @@ void OrbitalInteractionMode::updateCameraStateFromMouseStates() {
|
||||
|
||||
newPosition = camPos + rotationDiffVec3;
|
||||
|
||||
glm::dvec3 lookUp = _camera->lookUpVectorWorldSpace();
|
||||
glm::dvec3 directionToCenter = glm::normalize(centerPos - newPosition);
|
||||
|
||||
glm::dvec3 lookUpWhenFacingCenter =
|
||||
_globalCameraRotation * glm::dvec3(_camera->lookUpVectorCameraSpace());
|
||||
glm::dmat4 lookAtMat = glm::lookAt(
|
||||
glm::dvec3(0, 0, 0),
|
||||
glm::normalize(centerPos - newPosition),
|
||||
lookUp);
|
||||
directionToCenter,
|
||||
lookUpWhenFacingCenter);
|
||||
_globalCameraRotation =
|
||||
glm::normalize(glm::quat_cast(glm::inverse(lookAtMat)));
|
||||
}
|
||||
@@ -804,7 +807,7 @@ void OrbitalInteractionMode::updateCameraStateFromMouseStates() {
|
||||
glm::dvec3 centerToBoundingSphere =
|
||||
glm::normalize(posDiff) *
|
||||
static_cast<double>(_focusNode->boundingSphere().lengthf());
|
||||
newPosition += -(posDiff + centerToBoundingSphere) *
|
||||
newPosition += -(posDiff - centerToBoundingSphere) *
|
||||
_truckMovementMouseState.velocity.get().y;
|
||||
}
|
||||
{ // Do roll
|
||||
|
||||
Reference in New Issue
Block a user