Add NavMeshPathFlags to navmesh for partial paths info

This commit is contained in:
Wojtek Figat
2023-08-31 09:37:27 +02:00
parent 540681e59d
commit 5500e99ed8
2 changed files with 31 additions and 2 deletions

View File

@@ -78,9 +78,10 @@ bool NavMeshRuntime::FindDistanceToWall(const Vector3& startPosition, NavMeshHit
return true;
}
bool NavMeshRuntime::FindPath(const Vector3& startPosition, const Vector3& endPosition, Array<Vector3, HeapAllocation>& resultPath) const
bool NavMeshRuntime::FindPath(const Vector3& startPosition, const Vector3& endPosition, Array<Vector3, HeapAllocation>& resultPath, NavMeshPathFlags& resultFlags) const
{
resultPath.Clear();
resultFlags = NavMeshPathFlags::None;
ScopeLock lock(Locker);
const auto query = GetNavMeshQuery();
if (!query || !_navMesh)
@@ -120,6 +121,7 @@ bool NavMeshRuntime::FindPath(const Vector3& startPosition, const Vector3& endPo
if (pathSize == 1 && dtStatusDetail(findPathStatus, DT_PARTIAL_RESULT))
{
resultFlags |= NavMeshPathFlags::PartialPath;
// TODO: skip adding 2nd end point if it's not reachable (use navmesh raycast check? or physics check? or local Z distance check?)
resultPath.Resize(2);
resultPath[0] = startPosition;