1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00

Transform path coordinates outside findSmoothPath

This commit is contained in:
elsid 2023-04-28 13:30:08 +02:00
parent 19940987a3
commit fcea153947
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625
2 changed files with 6 additions and 5 deletions

View File

@ -253,7 +253,7 @@ namespace DetourNavigator
template <class OutputIterator>
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<dtPolyRef> polygonPath(settings.mDetour.mMaxPolygonPathSize);
std::vector<dtPolyRef> 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<OutputIterator>(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;

View File

@ -36,11 +36,13 @@ namespace DetourNavigator
if (navMesh == nullptr)
return Status::NavMeshNotFound;
const Settings& settings = navigator.getSettings();
auto outTransform = OutputTransformIterator<OutputIterator>(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);
}
/**