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...
C++ directx9 finding 3d mouse position
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement