Z
Z
Zefirot2022-03-17 21:59:24
Unity
Zefirot, 2022-03-17 21:59:24

What to do if MeshAgentPath.corners gives wrong coordinates?

I need to get the necessary points passing through the terrain, I get them like this

Vector3[] MeshCorners = new Vector3[]{};
MeshAgentPath = new NavMeshPath();
NavMesh.CalculatePath(TargetA.transform.position, TargetB.transform.position, NavMesh.AllAreas, MeshAgentPath);
if(MeshAgentPath.status == NavMeshPathStatus.PathComplete){
  MeshCorners = MeshAgentPath.corners;

It often gives out normal coordinates, but sometimes it’s generally crazy, for example, it must move in a straight line, but the coordinates are lined up so that it moves straight then down somewhere, then again to the previous position and then further, or not straight, but obliquely forward down and also obliquely up , although it was possible directly ... I

already set up the agent, voxels, tiles, but still nothing ...
I think maybe I'm calculating incorrectly in the code, maybe there are some pitfalls?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question