Complex if and/or statement for finding neighboring triangles in a mesh
I'm trying to find the immediate neighbors of a clicked triangle in a mesh, those that share a side (and two vertices.) To do this I find the coordinates of the vertexes of the clicked triangle and assign them to the Vector3's v1, v2, and v3. Then I start a loop to go through all of the other triangles on the mesh, one at a time, storing their vertexes to v4, v5, and v6.
I only move on to the next step if any two of those points match so I wrote this monstrosity:
if ((v1==v4 && v2 == v5)||(v1==v4 && v2 == v6)|| (v1 == v4 && v3==v5) || (v1 == v4 && v3==v6) || (v1 == v5 && v2 == v4) || (v1 == v5 && v2 == v6) || (v1 == v5 && v3 == v4) || (v1 == v5 && v3 == v6) || (v1 == v6 && v2 == v4) || (v1 == v6 && v2==v5) || (v1 == v6 && v3==v4) || (v1 == v6 && v3==v6))
The code doesn't run to completion and debugging shows me this line is never executed, or if it is it doesn't finish. I'm assuming this syntax is a no-go (this being said I don't get an error). How would you write it?
Answer by unity_zjCgQ21xcO2QTQ · Oct 08, 2017 at 04:43 PM
Sorry, am an idiot. Did not do due diligence with the debugging. This line is fine, there was a different error.
Your answer
Follow this Question
Related Questions
Vertex colors not working in shader graph. 0 Answers
Rotate a point around a mesh vertex 1 Answer
Assigning Values In Start () That Will Change 1 Answer
Edit SkinnedMesh with vertices 0 Answers
How to partially change texture? 0 Answers