mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-10 06:34:16 +00:00
...
This commit is contained in:
parent
74514cb91e
commit
9b521a7e96
1 changed files with 13 additions and 1 deletions
|
@ -67,16 +67,28 @@ namespace SanAndreasUnity.Utilities
|
|||
Vector3 myPosition = agent.transform.position;
|
||||
|
||||
agent.nextPosition = myPosition;
|
||||
if (agent.nextPosition.WithXAndZ() != myPosition.WithXAndZ()
|
||||
|
||||
Vector3 retreivedNextPosition = agent.nextPosition;
|
||||
|
||||
if (retreivedNextPosition.WithXAndZ() != myPosition.WithXAndZ()
|
||||
&& Time.time - m_lastTimeWhenWarped > 1f)
|
||||
{
|
||||
m_lastTimeWhenWarped = Time.time;
|
||||
|
||||
bool bWarp = false;
|
||||
bool bSetDestination = false;
|
||||
|
||||
if (agent.Warp(myPosition))
|
||||
{
|
||||
bWarp = true;
|
||||
if (this.Destination.HasValue && agent.isOnNavMesh)
|
||||
{
|
||||
this.SetDestination();
|
||||
bSetDestination = true;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"warped agent {this.name} - bWarp {bWarp}, isOnNavMesh {agent.isOnNavMesh}, pos diff {retreivedNextPosition - myPosition}, bSetDestination {bSetDestination}", this);
|
||||
}
|
||||
|
||||
//this.NavMeshAgent.velocity = this.Velocity;
|
||||
|
|
Loading…
Reference in a new issue