Here’s the code I tried :
NavMeshHit hit;
if (NavMesh.SamplePosition (transform.position, out hit, 2f, NavMesh.AllAreas)) {
Debug.Log(_agent.Warp (hit.position));
}
In some places it somehow prints false.
My question is, what are the things that causes a Warp() to return false? The documentation isn’t clear enough and doesn’t explain it, so I presume it will return false if the Warp parameter is not on NavMesh
. But in my example, the point is clearly on NavMesh, because I used SamplePosition to retrieve the point, and it’s no doubt successful (the SamplePosition returns true). I’d really appreciate if anyone can enlighten me on this, thanks.