Jump to content
  • Advertisement

Archived

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

VECTOR

2d mouse,3d object, how do I tell mouse is over it

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

is there and offscreen selection buffer I can use? Is it that easy to use or is there easier ways of doing this? What I want is the type of thing in Homeworld, where you can select ships in 3d using 2d mouse pointer.

Share this post


Link to post
Share on other sites
Advertisement
one way to do this is to draw a frame of colored untextured objects(dont display it to the screen) and use glReadPixels(?) to check what the color is under the mouse pointer and select that object.


Theres probably an easier way by using a matrix to find where the mouse is in 3d space, but i dont know how to do that, sorry.

Share this post


Link to post
Share on other sites
hi
you can take a look at the "OpenGl Super Bible" chapter 19 :

http://www.itknowledge.com/reference/archive/1571690735/ch19/591-593.html#Heading2

lunasol

Share this post


Link to post
Share on other sites
hi
you can take a look at the "OpenGl Super Bible" chapter 19 :

http://www.itknowledge.com/reference/archive/1571690735/ch19/591-593.html#Heading2

lunasol

Share this post


Link to post
Share on other sites
Another way you can do it is to cast a ray from the tip of your cursor a specified distance out (taking into account for perspective) and collision detect that ray with the objects in your scene. This works best if you render models from specific data structures and have ray/object, ray/sphere, or ray/polygon collision detection implemented. I know you may not want to go this route, but it is another method for people to keep in mind.

Morgan

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!