mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-02-16 12:58:27 +00:00
add 2nd solution for problem with long paths
This commit is contained in:
parent
d5a84e0c7f
commit
36306b4484
1 changed files with 13 additions and 0 deletions
|
@ -256,6 +256,19 @@ namespace SanAndreasUnity.Utilities
|
|||
return;
|
||||
}
|
||||
|
||||
// 2nd solution for problem above
|
||||
|
||||
float distanceTraveled = (myPosition - m_lastPositionWhenAssignedDestination.Value).magnitude;
|
||||
|
||||
if (currentTime - m_lastTimeWhenSearchedForPath > 3f
|
||||
&& distanceTraveled > 200f
|
||||
&& agent.pathStatus == NavMeshPathStatus.PathPartial)
|
||||
{
|
||||
Debug.Log($"re-path due to bug in NavMesh system #2 - agent {agent.name}, distanceTraveled {distanceTraveled}", this);
|
||||
this.SetDestination();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SetDestination()
|
||||
|
|
Loading…
Add table
Reference in a new issue