Jump to content
  • Advertisement

Archived

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

randomseed

2D cursor in 3D Game?

This topic is 5768 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know how covert a cursor point that is on a flat plane to its corresponding point on say a point on terrain that is in perspective. This is to sort of accomplish the effect in say warcraft3 when you rotate the camera, but the cursor is still flat on the screen, so obivously the point you click on is not the same as the screen coorinates the cursor is on. Thanx ransomseed

Share this post


Link to post
Share on other sites
Advertisement
That would work although there are more effective ways of doing it. I usually create a ray and fire it out from the camera, checking ray/sphere or ray/box collision on all objects on-screen. search for "mouse picking" or "ray picking" tutorials or articles. The DirectX 8 SDK comes with a good picking example. I think gametutorials.com have one as well.

Share this post


Link to post
Share on other sites
in Open GL it is something like glProject and glunproject. Directx has the same functions, just search for any functions with the name project or unproject in them...hopefully this will help..

-lucas

Share this post


Link to post
Share on other sites
I am not sure I was clear on what I mean, you take a grid or plane or whatever then rotate the camera around it so that the grid is now in perspective. Now say the grid has a mac height of 100 and before the camera is rotated the top of the grid is at the top of the screen, but after it is rotated it is now at say somewhere between the top and the middle of the screen. so now what I need to do is somehow transform the screen coords so that if I have the cursor on the screen say at 50(where the top of the grid is) it translates that as being at 100 on the grid.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!