Jump to content
  • Advertisement
Sign in to follow this  
spiffycrony

What can be wrong?

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

I am trying to get the screen coordinate from the 3d coordinate. This seems to be simple at first and i am using D3DXVec3Project. I get the correct(screen coordinates) values at start. But once i rotate the model, i am getting -ve x values although the model is in the view. What are the possible errors i can make? The function is as follows Public Function GetProjection(ByRef pointout As D3DVECTOR, ByRef point As D3DVECTOR) Dim viewport As D3DVIEWPORT8 Dim proj As D3DMATRIX Dim view As D3DMATRIX Dim world As D3DMATRIX m_d3d.Device.GetViewport viewport m_d3d.Device.GetTransform D3DTS_PROJECTION, proj m_d3d.Device.GetTransform D3DTS_VIEW, view m_d3d.Device.GetTransform D3DTS_WORLD, world D3DXVec3Project pointout, point, viewport, proj, view, world End Function PS: The problem is only when i rotate the model. Panning the model and scaling seems to be fine. [Edited by - spiffycrony on March 24, 2007 12:24:53 AM]

Share this post


Link to post
Share on other sites
Advertisement
Are you sure the world matrix is being rotated correctly? You're not rotating the view matrix are you? And are you sure that the point actually is supposed to have a +ve x value?

Try creating some test cases you can do out on pen/paper to verify.

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.

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!