So I’m currently getting an error, where when it’s trying to calculate the path but it can’t reach that point, it’s trying to find a path using a Vector3 with Infinity at every point.

I tried to set a safety line that says

if (navMeshHit.position == Vector3.positiveInfinity ||

navMeshHit.position == Vector3.negativeInfinity) return false;

and THEN using that to try to find the path, but it doesn’t seem to be helping stop this from happening.

Here’s the error message:

CalculatePolygonPath: invalid input position(s). Source position { -19.149866, -0.009147, -23.018562 }. Target position { Infinity, Infinity, Infinity }

UnityEngine.AI.NavMesh:CalculatePath (UnityEngine.Vector3,UnityEngine.Vector3,int,UnityEngine.AI.NavMeshPath)

(etc)

Any ideas as to what’s going wrong?