Advertisement

Hit-Testing?

Started by May 11, 2003 04:37 PM
2 comments, last by Alhexx 21 years, 9 months ago
I''m trying to write a model editor for game models. However, I''ve got a problem. For an editor, I need to integrate a "Hit-Testing"-Function, with which I can check, which Vertex or Triangle a User has selected. Any Ideas? - Alhexx
Two(ish) ways: OpenGL picking (don''t know much about this, never used it) and ray/primitive.

The ray method basically involves transforming the 2D coordinate of the mouse (or whatever pointer) on the viewport into 3D space, then creating a ray from that point out into the world. That ray is then tested against all the objects using ray/triangle, ray/edge or even ray/point (or ray/whatever primitive you want) intersection tests.
Advertisement
One more way: Render your scene using key colors for the objects and retirieve the color at the mouse loc.
JuNC:
Thanx. That ray methods sounds quite interesting... but is there any tutorial or some source code available?

- Alhexx

This topic is closed to new replies.

Advertisement