C++ directx9 finding 3d mouse position

Started by
11 comments, last by r_bewick 14 years, 7 months ago
I don't have sample code or anything like that, but you already have the basic parts implemented. Do something like this:

1. Use picking to find the object being clicked on. Calculate and save the 3D world space position of the intersection point.

2. As long as the mouse button is down you are in 'dragging' mode. For each time step that you check this, find the new 3D world space position of the mouse if you assume the same depth as the initial point.

3. Subtract the two points to find the needed translation vector (which is in world space). Then translate by that amount.

That should get you in the ball park I think...
Advertisement
WOW - thanks Jason Z I will definitely follow that.
Edit: I have got it working except that when I change the camera position my mouse position stuffs up. How can I fix this?

[Edited by - r_bewick on September 20, 2009 4:34:22 AM]
anyone?

This topic is closed to new replies.

Advertisement