Skip to content

Commit 1e5ff25

Browse files
committed
fix bugs in up direction update
1 parent 2012f51 commit 1e5ff25

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/view.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,12 +489,13 @@ void updateViewAndChangeUpDir(UpDir newUpDir, bool flyTo) {
489489
case NavigateStyle::Arcball:
490490
case NavigateStyle::FirstPerson: {
491491
glm::vec3 lookDir = getCameraParametersForCurrentView().getLookDir();
492-
if (std::fabs(dot(view::getUpVec(), lookDir) < 0.01)) {
492+
if (std::fabs(dot(view::getUpVec(), lookDir)) < 0.01) {
493493
// if the new up direction is colinear with the direction we're currently looking
494494
lookDir = getFrontVec();
495495
}
496496

497-
lookAt(getCameraWorldPosition(), lookDir * state::lengthScale, flyTo);
497+
glm::vec3 camPos = getCameraWorldPosition();
498+
lookAt(camPos, camPos + lookDir * state::lengthScale, flyTo);
498499

499500
break;
500501
}

0 commit comments

Comments
 (0)