Page 1 of 1

Getting the source mesh vertices from a triangle selector

Posted: Sun Oct 25, 2009 11:24 pm
by Neuman
Basically, my goal is to get the three vertex indices within a mesh buffer for a triangle involved in a collision. This would allow me to directly access the mesh properties at the collision area, and do things like dynamically alter the material texture based on where the collision occurs.

I'm pretty sure I'm not the only one who might want to be able to do this, but the more I look into it, the more I suspect I may have to edit the engine source code in order to get it working right. Am I right, or am I missing something obvious? Mesh buffers don't seem to have any use for triangle3df objects, and the only solution that doesn't involve recompiling seems to be to search the mesh buffer for each triangle vertex at every collision, which seems like it would be really slow. Any suggestions?

Posted: Mon Oct 26, 2009 4:43 am
by vitek
The Irrlicht collision system will get you the triangle that had the collision, but it doesn't do anything to help you identify the indices of the vertices that the triangle is made from. This is an artifact of the design of the Irrlicht collision system. It is primitive and was really only used for camera collisions.

Travis

Posted: Thu Oct 29, 2009 6:47 pm
by Neuman
I may add that capability to the engine in the near future. I wanted to add functionality where clicking on a mesh could give you back the texture coordinates of the part you clicked on, presumably by interpolating between the three vertices that make up the triangle that was clicked on. These coordinates could then be mapped back to another not-visible texture which would be color coded so the computer would be able to distinguish between various areas that could be clicked on.

This wouldn't be very hard to implement, but it would have to store indices and thus take up a bit more memory.