Answer the question
In order to leave comments, you need to log in
Why doesn't the vector comparison condition work?
MeshAgent often gives me an array with a vector of 0, 0, 0 , why I don’t understand, but I decided to exclude it from the array altogether
private Vector3 VectorNull = new Vector3(0f, 0f, 0f);
.....
if(MeshCorners.Length > 2){
int ln = 0;
foreach(Vector3 vl in MeshCorners){ if(vl != VectorNull){ Debug.Log("XX=> " + vl); ++ln; }}
Vector3[] TempMeshCorners = new Vector3[ln]; ln = 0;
foreach(Vector3 vl in MeshCorners){ if(vl != VectorNull){ TempMeshCorners[ln] = vl; ++ln; }}
MeshCorners = TempMeshCorners;
}
XX=> (-0.1, -0.2, 0.0)
XX=> (0.0, 0.0, 0.0)
XX=> (1.4, 1.2, 0.0)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question