Jump to content
  • Advertisement

Archived

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

Christoph

Vector unprojection produces funny stuff

This topic is 5144 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 there, I simply want to know the screen coordinates of a 3D-vector (the sun for lens flares...). I am using the Vector3.Unproject function (yes, it's managed DirectX...).

d3dDev.Transform.World = Matrix.Identity

Dim v As New Viewport
v.Width = d3dDev.PresentationParameters.BackBufferWidth '1024
v.Height = d3dDev.PresentationParameters.BackBufferHeight '768
v.MaxZ = 1

r_Vector.Unproject(vec, v, engine.d3dDev.Transform.Projection, engine.d3dDev.Transform.View, engine.d3dDev.Transform.World)
However, the result is weird and unlogical. For testing, I just took the vector (0,0,0), but at the starting point, when the camera is looking directly at this point, the unprojection is not (512|384|0) (the center of the screen), but (0|0|0). Only when the camera changes its position, the values are changing as well, but they don't represent screen coordinates... Can somebody please tell me how I really receive screen coordinates from a vector? [edited by - Christoph on May 25, 2004 2:56:12 PM]

Share this post


Link to post
Share on other sites
Advertisement

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