Jump to content
  • Advertisement

Archived

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

Blue*Omega

On screen coordinates

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

Heres an interesting question... How can you find out an obejects on screen coordanites? If that didn''t make any sense I''ll give an example. Sy in a 3D rpg you find out a charecters stats by pointing the mouse at them. how would you detect if the mouse was on that object? ----------------------------- Blue*Omega (Insert Witty Quote Here)

Share this post


Link to post
Share on other sites
Advertisement
How fast is the feedback buffer? Is there a way to do it mathmatically? Which would be the easiest/fastest way to do it?

Just curious..


~-=-=-=-=-=-=~
~Justin Eslinger~
~.."BlackScar"..~
~-=-=-=-=-=-=~

Share this post


Link to post
Share on other sites
You could project an object''s position from 3D to 2D, and then check the distance. Do this with all objects, and you will know which one is closest.


To go from 3D to 2D: (Projection)

    
double x,y,z; // 3D world coords

double sx,sy; // 2D screen coords


double _sz = FOV / z;
sx = _sz * x;
sy = _sz * y;


This was a simple example, and you probably have to multiply the sx & sy values with the aspect/frustrum sizes...

Hope this helps,
- Bas

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!