Jump to content
  • Advertisement
Sign in to follow this  
lordarkam

Screen coords in DirectX

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

Which is the faster way to calculate the screen coords of an object using DirectX? I write my own code but I´ve some problems with it. Basically I detect the same screen coords when the camera is facing towards the object and it´s visible (right) and when the camera is facing back the object (wrong).

Share this post


Link to post
Share on other sites
Advertisement
Thanks a lot. I´m testing if .z is less than 1.0 and it works.
It´s not exactly the negative test that you tell me, but if it works, it´s good :D

I´m not sure why, but when you facing the object .z values are smaller than 1.0 while when you are facing back the .z values are bigger. Any suggestion about it?

Share this post


Link to post
Share on other sites
It probably depends on your code too.

Usually after a full coordinate projection coordinates should be in a "box" of X [-1.0, 1.0], Y[-1.0, 1.0] and Z(0.0, 1.0f).
I'm not completely sure about the values, but i remember having the same problem with picking and it worked when i dismissed objects which gave me negative .z.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!