Better handle interpolation when setting interpolation time to 0

Prevent NaNs from appearing when selecting a linear flight distance of 0 (closes #1329)
This commit is contained in:
Alexander Bock
2020-10-21 00:53:12 +02:00
parent a93b5fdf10
commit 8cf5f96392
3 changed files with 22 additions and 4 deletions
+6 -1
View File
@@ -1271,7 +1271,12 @@ glm::dvec3 OrbitalNavigator::moveCameraAlongVector(const glm::dvec3& camPos,
velocity = 1.0 - destination / distFromCameraToFocus;
}
else { // When flying away from anchor
velocity = distFromCameraToFocus / destination - 1.0;
if (destination == 0.0) {
velocity = -1.0;
}
else {
velocity = distFromCameraToFocus / destination - 1.0;
}
}
velocity *= _velocitySensitivity;