From fcea153947ec52366ba3a5aa0e89841f98d3ec59 Mon Sep 17 00:00:00 2001 From: elsid Date: Fri, 28 Apr 2023 13:30:08 +0200 Subject: [PATCH] Transform path coordinates outside findSmoothPath --- components/detournavigator/findsmoothpath.hpp | 7 +++---- components/detournavigator/navigatorutils.hpp | 4 +++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/detournavigator/findsmoothpath.hpp b/components/detournavigator/findsmoothpath.hpp index 2e9ffa83be..eded2c9baa 100644 --- a/components/detournavigator/findsmoothpath.hpp +++ b/components/detournavigator/findsmoothpath.hpp @@ -253,7 +253,7 @@ namespace DetourNavigator template Status findSmoothPath(const dtNavMesh& navMesh, const dtNavMeshQuery& navMeshQuery, const osg::Vec3f& halfExtents, const float stepSize, const osg::Vec3f& start, const osg::Vec3f& end, const Flags includeFlags, - const AreaCosts& areaCosts, const Settings& settings, float endTolerance, OutputIterator out) + const AreaCosts& areaCosts, const DetourSettings& settings, float endTolerance, OutputIterator out) { dtQueryFilter queryFilter; queryFilter.setIncludeFlags(includeFlags); @@ -274,7 +274,7 @@ namespace DetourNavigator if (endRef == 0) return Status::EndPolygonNotFound; - std::vector polygonPath(settings.mDetour.mMaxPolygonPathSize); + std::vector polygonPath(settings.mMaxPolygonPathSize); const auto polygonPathSize = findPath(navMeshQuery, startRef, endRef, start, end, queryFilter, polygonPath.data(), polygonPath.size()); @@ -285,9 +285,8 @@ namespace DetourNavigator return Status::Success; const bool partialPath = polygonPath[*polygonPathSize - 1] != endRef; - auto outTransform = OutputTransformIterator(out, settings.mRecast); const Status smoothStatus = makeSmoothPath(navMesh, navMeshQuery, queryFilter, start, end, stepSize, - polygonPath, *polygonPathSize, settings.mDetour.mMaxSmoothPathSize, outTransform); + polygonPath, *polygonPathSize, settings.mMaxSmoothPathSize, out); if (smoothStatus != Status::Success) return smoothStatus; diff --git a/components/detournavigator/navigatorutils.hpp b/components/detournavigator/navigatorutils.hpp index 473c2f11c9..1c9dbc5682 100644 --- a/components/detournavigator/navigatorutils.hpp +++ b/components/detournavigator/navigatorutils.hpp @@ -36,11 +36,13 @@ namespace DetourNavigator if (navMesh == nullptr) return Status::NavMeshNotFound; const Settings& settings = navigator.getSettings(); + auto outTransform = OutputTransformIterator(out, settings.mRecast); const auto locked = navMesh->lock(); return findSmoothPath(locked->getImpl(), locked->getQuery(), toNavMeshCoordinates(settings.mRecast, agentBounds.mHalfExtents), toNavMeshCoordinates(settings.mRecast, stepSize), toNavMeshCoordinates(settings.mRecast, start), - toNavMeshCoordinates(settings.mRecast, end), includeFlags, areaCosts, settings, endTolerance, out); + toNavMeshCoordinates(settings.mRecast, end), includeFlags, areaCosts, settings.mDetour, endTolerance, + outTransform); } /**