display distance of found path

This commit is contained in:
in0finite 2022-03-26 23:53:46 +01:00
parent c258137b70
commit 10d3fe3f0c

View file

@ -302,7 +302,11 @@ namespace SanAndreasUnity.UI {
if (NavMesh.CalculatePath(sourcePos, targetPos, -1, path)) if (NavMesh.CalculatePath(sourcePos, targetPos, -1, path))
m_navMeshPathToWaypoint = path.corners; m_navMeshPathToWaypoint = path.corners;
Debug.Log($"Nav mesh path calculation done - status {path.status}, num corners {m_navMeshPathToWaypoint?.Length ?? 0}, time {sw.Elapsed.TotalMilliseconds} ms"); Debug.Log($"Nav mesh path calculation done - " +
$"status {path.status}, " +
$"num corners {m_navMeshPathToWaypoint?.Length ?? 0}, " +
$"total distance {m_navMeshPathToWaypoint?.Skip(1).Select((corner, i) => Vector3.Distance(corner, m_navMeshPathToWaypoint[i])).Sum()}, " +
$"time {sw.Elapsed.TotalMilliseconds} ms");
} }
} }