Jump to content
  • Advertisement

Archived

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

jbeder

object selection

This topic is 5385 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

I''m writing a 2D/3D game (think warcraft3), and I''m trying to figure out how to deal with mouse selection. I want the user to be able to click somewhere and have their character move to that place on the map, but I don''t know how to convert the mouse coordinates to the point on the ground. One option that I don''t want to do is to tile the ground in selection mode, determine if one of the tiles has been selected, and then move the character there. That seems like a BAD solution to me, especially since there is a limit on the number of objects that can be in the selection buffer. It seems as though this problem should have come up before. Is there any nice way of solving it? Any help is greatly appreciated, Jesse Beder

Share this post


Link to post
Share on other sites
Advertisement
Can't you use glUnProject() (don't ask me how it works, but I think that what it's used for

EDIT: ups... its gluUnProject... still don't know how it works, though!

[edited by - NeViL tHe dEVil on September 25, 2003 5:01:38 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
http://onemancrew.sinfree.net
under downloads you''ll find example.

Share this post


Link to post
Share on other sites
Use glunproject to get a ray from the front of the screen to the back clipping plane.

Then use a read pixels to see where the ray colides with the 3d terrain. If you have a 2d terrain you can just find the XZ plane interect of that ray.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!