Get adjacents triangles

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
cadue
Posts: 72
Joined: Mon Mar 13, 2006 8:33 pm
Location: Italy - Friuli - Monfalcone - Staranzano

Get adjacents triangles

Post by cadue »

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
8)
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 (-:
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

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.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

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.
cadue
Posts: 72
Joined: Mon Mar 13, 2006 8:33 pm
Location: Italy - Friuli - Monfalcone - Staranzano

Post by cadue »

thank! I'll follow your advice
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 (-:
Post Reply