bug fix: returned path had duplicates of nodes
This commit is contained in:
parent
0f42ab2122
commit
c2b2b03b8f
@ -211,7 +211,7 @@ public:
|
||||
/// @returns The status flags for the query.
|
||||
dtStatus initSlicedFindPath(dtPolyRef startRef, dtPolyRef endRef,
|
||||
const float* startPos, const float* endPos,
|
||||
const dtQueryFilter* filter, const unsigned int options=0);
|
||||
const dtQueryFilter* filter, const unsigned int options=DT_FINDPATH_ANY_ANGLE);
|
||||
|
||||
/// Updates an in-progress sliced path query.
|
||||
/// @param[in] maxIter The maximum number of iterations to perform.
|
||||
|
@ -1216,6 +1216,7 @@ dtStatus dtNavMeshQuery::updateSlicedFindPath(const int maxIter, int* doneIters)
|
||||
}
|
||||
|
||||
RaycastHit rayHit;
|
||||
rayHit.maxPath = 0;
|
||||
|
||||
int iter = 0;
|
||||
while (iter < maxIter && !m_openList->empty())
|
||||
@ -1468,6 +1469,9 @@ dtStatus dtNavMeshQuery::finalizeSlicedFindPath(dtPolyRef* path, int* pathCount,
|
||||
int m;
|
||||
status = raycast(node->id, node->pos, next->pos, m_query.filter, &t, normal, path+n, &m, maxPath-n);
|
||||
n += m;
|
||||
// raycast ends on poly boundary and the path might include the next poly boundary.
|
||||
if (path[n-1] == next->id)
|
||||
n--; // remove to avoid duplicates
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user