Sign in to follow this  
devronious

Control to World coordinate...

Recommended Posts

devronious    108
The device already transforms the world coordinates into the windows control coordinate. But what if I want to transform a coordinate from the 2d control to 3d world space? Thanks, Devin

Share this post


Link to post
Share on other sites
jollyjeffers    1570
A 2D coordinate (such as a mouse click location) actually generates a "ray" in 3D space - effectively an infinite number of points along a defined line from the near plane to the far plane.

You can use the D3DXVec3Unproject() function to take the various matrices and coordinates and produce a ray iirc.

hth
Jack

Share this post


Link to post
Share on other sites
devronious    108
Super, thanks. I was wondering, which matrices to I unproject? I see in the device that there are several matrices. Are all of the used during the scene?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this