Converting screen coordinates to 3D world coordinates

Started by
9 comments, last by Buckeye 10 years ago

I read it's best to make the near-far range as small as possible to make the most of limited depth buffer precision.

That's correct.

The pick method described will still work. It's just a matter of converting the mouse coordinates to the vector in world space that screen position represents. You'll still end up with the world position of the ground under that screen position.

As you mentioned, you can also use the depth buffer (if you have access to it). Make a vector of (mousex, mousey, depth-buffer-value) and unproject it to get the world position. Note, however, that method will give the world position of whatever object was rendered at that pixel - it may not be the ground plane.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement