#### Archived

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

# On screen coordinates

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

## 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 on other sites
Use the feedback buffer ...

##### Share on other sites
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 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 coordsdouble sx,sy; // 2D screen coordsdouble _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

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 18
• 20
• 14
• 14
• 9
• ### Forum Statistics

• Total Topics
633370
• Total Posts
3011542
• ### Who's Online (See full list)

There are no registered users currently online

×