mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-12 14:36:44 +00:00
Transform path coordinates outside findSmoothPath
This commit is contained in:
parent
19940987a3
commit
fcea153947
2 changed files with 6 additions and 5 deletions
|
@ -253,7 +253,7 @@ namespace DetourNavigator
|
||||||
template <class OutputIterator>
|
template <class OutputIterator>
|
||||||
Status findSmoothPath(const dtNavMesh& navMesh, const dtNavMeshQuery& navMeshQuery, const osg::Vec3f& halfExtents,
|
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 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;
|
dtQueryFilter queryFilter;
|
||||||
queryFilter.setIncludeFlags(includeFlags);
|
queryFilter.setIncludeFlags(includeFlags);
|
||||||
|
@ -274,7 +274,7 @@ namespace DetourNavigator
|
||||||
if (endRef == 0)
|
if (endRef == 0)
|
||||||
return Status::EndPolygonNotFound;
|
return Status::EndPolygonNotFound;
|
||||||
|
|
||||||
std::vector<dtPolyRef> polygonPath(settings.mDetour.mMaxPolygonPathSize);
|
std::vector<dtPolyRef> polygonPath(settings.mMaxPolygonPathSize);
|
||||||
const auto polygonPathSize
|
const auto polygonPathSize
|
||||||
= findPath(navMeshQuery, startRef, endRef, start, end, queryFilter, polygonPath.data(), polygonPath.size());
|
= findPath(navMeshQuery, startRef, endRef, start, end, queryFilter, polygonPath.data(), polygonPath.size());
|
||||||
|
|
||||||
|
@ -285,9 +285,8 @@ namespace DetourNavigator
|
||||||
return Status::Success;
|
return Status::Success;
|
||||||
|
|
||||||
const bool partialPath = polygonPath[*polygonPathSize - 1] != endRef;
|
const bool partialPath = polygonPath[*polygonPathSize - 1] != endRef;
|
||||||
auto outTransform = OutputTransformIterator<OutputIterator>(out, settings.mRecast);
|
|
||||||
const Status smoothStatus = makeSmoothPath(navMesh, navMeshQuery, queryFilter, start, end, stepSize,
|
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)
|
if (smoothStatus != Status::Success)
|
||||||
return smoothStatus;
|
return smoothStatus;
|
||||||
|
|
|
@ -36,11 +36,13 @@ namespace DetourNavigator
|
||||||
if (navMesh == nullptr)
|
if (navMesh == nullptr)
|
||||||
return Status::NavMeshNotFound;
|
return Status::NavMeshNotFound;
|
||||||
const Settings& settings = navigator.getSettings();
|
const Settings& settings = navigator.getSettings();
|
||||||
|
auto outTransform = OutputTransformIterator<OutputIterator>(out, settings.mRecast);
|
||||||
const auto locked = navMesh->lock();
|
const auto locked = navMesh->lock();
|
||||||
return findSmoothPath(locked->getImpl(), locked->getQuery(),
|
return findSmoothPath(locked->getImpl(), locked->getQuery(),
|
||||||
toNavMeshCoordinates(settings.mRecast, agentBounds.mHalfExtents),
|
toNavMeshCoordinates(settings.mRecast, agentBounds.mHalfExtents),
|
||||||
toNavMeshCoordinates(settings.mRecast, stepSize), toNavMeshCoordinates(settings.mRecast, start),
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue