Getting the source mesh vertices from a triangle selector

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Neuman
Posts: 7
Joined: Thu Aug 03, 2006 2:37 pm
Contact:

Getting the source mesh vertices from a triangle selector

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

Post 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
Neuman
Posts: 7
Joined: Thu Aug 03, 2006 2:37 pm
Contact:

Post 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.
Post Reply