From 933580e08c45eca40d5c2e12e0bdafff7d5f2342 Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Mon, 21 Jun 2021 13:23:09 +0200 Subject: [PATCH] Use the parameter passed to the function for speed --- modules/autonavigation/path.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/autonavigation/path.cpp b/modules/autonavigation/path.cpp index a3c7e6e42c..8569a2918f 100644 --- a/modules/autonavigation/path.cpp +++ b/modules/autonavigation/path.cpp @@ -182,7 +182,7 @@ double Path::speedAlongPath(double traveledDistance) { const glm::dvec3 endNodePos = _end.node()->worldPosition(); const glm::dvec3 startNodePos = _start.node()->worldPosition(); - const CameraPose prevPose = interpolatedPose(_traveledDistance); + const CameraPose prevPose = interpolatedPose(traveledDistance); const double distanceToEndNode = glm::distance(prevPose.position, endNodePos); const double distanceToStartNode = glm::distance(prevPose.position, startNodePos); @@ -200,15 +200,15 @@ double Path::speedAlongPath(double traveledDistance) { // Dampen speed in beginning of path const double startUpDistance = 2.0 * _start.node()->boundingSphere(); - if (_traveledDistance < startUpDistance) { - speed *= _traveledDistance / startUpDistance + 0.01; + if (traveledDistance < startUpDistance) { + speed *= traveledDistance / startUpDistance + 0.01; } // Dampen speed in end of path // Note: this leads to problems when the full length of the path is really big const double closeUpDistance = 2.0 * _end.node()->boundingSphere(); - if (_traveledDistance > (pathLength() - closeUpDistance)) { - const double remainingDistance = pathLength() - _traveledDistance; + if (traveledDistance > (pathLength() - closeUpDistance)) { + const double remainingDistance = pathLength() - traveledDistance; speed *= remainingDistance / closeUpDistance + 0.01; }