screen coords to world ::?

Started by
3 comments, last by Endurion 18 years, 9 months ago
hallo,sorry...i guess somebody have been post this question before but i can't find it, how do i get world coordinates from screen coordinates...? for mouse
Advertisement
Use the D3DXVec3Transform(D3DXVECTOR4 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM) function (copied straight from the docs :) ).

Supply your screen x,y,z as a vector pV and the world matrix as pM. You will get the transformed co-ords in pOut as a vector.
"There is no dark side of the moon." - Pink Floyd
Do notice however, that you can't get a xyz world point from a xy screen point. Instead, you will get a line
posted by Anonymous :
Do notice however, that you can't get a xyz world point from a xy screen point. Instead, you will get a line


what do you mean get a line ?, i dont understand...:) sorry...
actually i want to make my mouse cursor move along terrain map... like...warcraft3...maybe...
help me....
:)
thanks
Hi,

take a look at the page of the nexe.gamedev.net:

Picking.

It also explains the theory behind the line vs. point dilemma.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

This topic is closed to new replies.

Advertisement