diff --git a/include/openspace/navigation/path.h b/include/openspace/navigation/path.h index a376684cd4..fc9fd79a0e 100644 --- a/include/openspace/navigation/path.h +++ b/include/openspace/navigation/path.h @@ -75,6 +75,12 @@ public: */ CameraPose traversePath(double dt, float speedScale = 1.f); + /** + * Function that can be used to permaturely quit a path ,for example when skipping + * to the end + */ + void quitPath(); + /** * Return the identifer of the node that is the current appropriate anchor node, of * the start and end waypoint's reference node. Dtermined based on how far along the diff --git a/src/navigation/path.cpp b/src/navigation/path.cpp index 0b3fd62ed2..48032b2d44 100644 --- a/src/navigation/path.cpp +++ b/src/navigation/path.cpp @@ -177,6 +177,11 @@ CameraPose Path::traversePath(double dt, float speedScale) { return newPose; } +void Path::quitPath() { + _traveledDistance = pathLength(); + _shouldQuit = true; +} + std::string Path::currentAnchor() const { bool pastHalfway = (_traveledDistance / pathLength()) > 0.5; return (pastHalfway) ? _end.nodeIdentifier() : _start.nodeIdentifier(); diff --git a/src/navigation/pathnavigator.cpp b/src/navigation/pathnavigator.cpp index d1638cc7c4..0caefdbfd4 100644 --- a/src/navigation/pathnavigator.cpp +++ b/src/navigation/pathnavigator.cpp @@ -217,6 +217,7 @@ void PathNavigator::updateCamera(double deltaTime) { if (_setCameraToEndNextFrame) { LDEBUG("Skipped to end of camera path"); + _currentPath->quitPath(); camera()->setPose(_currentPath->endPoint().pose()); global::navigationHandler->orbitalNavigator().setFocusNode( _currentPath->endPoint().nodeIdentifier(),