Hi is there any way to get the X,Y,Z of mouse in direct3d after I translate and rotate the world matrix?
Asked
Active
Viewed 202 times
2 Answers
0
The mouse doesn't have a Z coordinate because it's not a three-dimensional pointing device.
The best you can do is project the mouse's (x,y) coordinate on the screen through the viewing frustum to determine which portion of the viewing frustum correlates to the pixel position under the mouse cursor.

legalize
- 2,214
- 18
- 25
0
DirectX is completely unaware of mouse and any other input devices. It just is not what it cares about.
To get x
and y
coordinates you call Win32 API functions (this depends on framework you are using)
To get a z
coordinate, you must implement Ray Picking. There is no uniform way, as this depends on how picked objects are implemented. Here are some tutorials on XNA Picking.

Ivan Aksamentov - Drop
- 12,860
- 3
- 34
- 61