Sign in to follow this  

Unit Picking

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

Hi, and i'm getting started on a simple 2D rts. I have the tilemap drawn, and a unit drawn, but I can't get selecting it down. I'm drawing with glVertex3f, and I'm using getCursorPos() to find my mouse coordinates when the left mouse button is pressed. getcursorPos() returns pixel values, and my unit is drawn with the units, or "f"s, such as 1.0f. How can I convert the return of the getCursorPos() to the type of measurement I am using to draw my soldier? Or am I going to need to change the code and use pixels to render everything?

Share this post


Link to post
Share on other sites
To do it this way, you have to transform the object to the screen by going through the modelview,perspective, then perspective division yourself. Then you can either translate the mouse into this space , or translate the objects to pixel space.

Share this post


Link to post
Share on other sites

This topic is 3669 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this