mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-10 06:34:16 +00:00
reset path if position can not be sampled
This commit is contained in:
parent
bc26a10ab5
commit
97f5dea402
1 changed files with 4 additions and 3 deletions
|
@ -218,8 +218,7 @@ namespace SanAndreasUnity.Utilities
|
|||
m_lastTimeWhenSearchedForPath = Time.time;
|
||||
m_lastAssignedDestination = this.Destination.Value;
|
||||
m_lastPositionWhenAssignedDestination = navMeshAgent.transform.position;
|
||||
this.CalculatedDestination = null;
|
||||
|
||||
|
||||
// here we need to sample position on navmesh first, because otherwise agent will fail
|
||||
// to calculate path if target position is not on navmesh, and as a result he will be stopped
|
||||
|
||||
|
@ -241,7 +240,9 @@ namespace SanAndreasUnity.Utilities
|
|||
}
|
||||
else
|
||||
{
|
||||
// TODO: reset agent's path
|
||||
// if position can not be sampled, we stop the agent
|
||||
navMeshAgent.ResetPath();
|
||||
this.CalculatedDestination = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue