PDA

View Full Version : Object Selection Question



blood.angel
02-27-2002, 01:57 AM
I have 72 triangles that act as 'selection' objects for the rubiks cube Im doing. The triangles are arranged on the cube, 12 to a side.
Im working with the selection code in Chapter 13 in the 'OpenGL Programming Guide' and my question is this.

Its possible for 2 or more of these selection triangles to overlap (as they are on opposite sides of the cube) and when the selection process occurs, does the computer automatically select the triangle closest to the camera? Or does it select all of them in that line of sight?

Furrage
02-27-2002, 06:15 AM
When using selection it selects all objects in line of sight (even hidden objects). Each selection/hit has two z values, min and max, which you can use to determine which hit is closer. If you want the one on top (eg the one under the mouse) search the hits for the one with the smallest z value.