HI! I get a triangle from a mesh by the collision detection whit a line. Hi want get the vertexes of the adjacent triangle. Is possible?? How??
thanks
Get adjacents triangles
Get adjacents triangles
excuse me for my bad english and for my ignorance...but I'm 14 and i come from Italy, where the study of english is a optional (-:
It would be much more efficient if you were already dealing with the index and vertex buffer, but you aren't.
If you have access to the vertex and index buffer you should be able to figure out which 3 indices refer to the vertices of the triangle. Once you know which indices you're dealing with, search the index buffer again for other faces that share one or more of those indices. Those would be the neighbors.
If you have access to the vertex and index buffer you should be able to figure out which 3 indices refer to the vertices of the triangle. Once you know which indices you're dealing with, search the index buffer again for other faces that share one or more of those indices. Those would be the neighbors.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Yes, but only if all triangles have the same material. Otherwise you have to check all mesh buffers, and maybe also having some floating point inaccuracies to deal with. Maybe try to get the correct triangle dimensions and aim across the triangle borders with the triangle selector or ray casting again.