🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

2D collision detection on 3D stuff

Started by
3 comments, last by CO 23 years, 11 months ago
I want to write a Landscape-Engine. I''ve use the ROAM-Algorithm and want to use the Mouse to manipulate the terrain on screen. But how can I translate 3D objects (polyon) to 2D screen coordinates? - How can I find out on which field (patch...) the Mouse (x, y on the screen) is currently on? - Or general, is it possible to find out the polygon on which the Mouse or an other 2D point is on? I know it''s possible to calculate the 3D points to 2D by hand, but is it possible to get out the vertex positions on screen which are calculated by OpenGL? HELP!!!
Advertisement
use gluUnproject()....
and for the winZ-parameter, use glReadPixel with GL_DEPTH_COMPONENT to get the z-value out of a pixel.

see more in the red book.

reply to this if you don''t understand what i''m talking about, and i''ll be more specific.
// Ankan
I''ve checked this in the VC documentation and... yeah!! That is it and it''s so easy! Thanks!

The red book, the red book, the red book, red book, red book...
all world speak''s about it!! Where can I buy it? Please give my input!
You can buy it just about anywhere online, I highly recommend fatbrain.com. I just ordered the red book and the blue book from there a few weeks ago, I received them very quickly and at a good price.

BTW you might want to consider the blue book too, its a really great reference for when you don''t need a tutorial but just can''t remember what function X needs



-----------------------
Go for it.
OtakuCODE
-----------------------Go for it.OtakuCODE
These are now in version 1.2, I think. You can find the 1.1 versions online, freely (of course, nothing beats paper). Just check the links on NeHe''s main page.

EL

----------------------------------------
"Inash neteia haeg joa kavari quilm..." SD4
----------------------------------------"Inash neteia haeg joa kavari quilm..." SD4

This topic is closed to new replies.

Advertisement