Archived

This topic is now archived and is closed to further replies.

Jo

Selecting Objects in 3D

Recommended Posts

Jo    122
This problem has probably already been answered before, but I''ve been having trouble with the search page for this forum. The basic problem is this: I have a point and click interface where I need to be able to do 2 things. Select objects from 3D space using an orthographic cursor location, and to be able to select points on the level data using similar restraints (walk-to commands). I''m aware that gluUnproject will give me a solution of sorts, but that''s not an option for me for the following reasons: I don''t use a depth buffer for the level data, as I store all that information in a BSP tree to avoid lagging my program with a z buffer, plus I have surfaces that use blending for transparency and reflection. gluUnproject doesn''t give the correct 3D space coords. X and Y coords are fine, but it tends to have a signifigant error factor for the Z coord, which gets bigger the farther along your viewing fustrum you are. So I''ve decided to use a Ray-Poly intersection method but I''ve run into a problem. How do I take a 2D orthographic screen coord and divine the correct ray from it? Another consideration is that the scene has camera rotations and transformations to further complicate things. Also my Ray-Poly algorithm takes a Ray-Plane intersection and checks to see if the point of intersection is within the bounds of the poly (always a convex triangle). Is there a better way? Thanks ----------------------------- Mice are an excellent source of mice.

Share this post


Link to post
Share on other sites
Jo    122
It seems like I always end up posting answers to my own question 5 minutes later

Anyhow here's a solution I found from another forum (over at openGL.org) that I found easy to understand and straightforward. I don't know if it can be optimized or not, but it's a start:

http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/000601.html

-----------------------------
Mice are an excellent source of mice.

Edited by - Jo on October 7, 2000 4:40:36 PM

Share this post


Link to post
Share on other sites