• Advertisement
Sign in to follow this  

Mouse-model movement in 3D

This topic is 3941 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm doing this model viewer experiment and I recently implemented a camera. Before, when moving the model, I could just map mouse x/y movement to the model x/y position. Now, when I rotate the camera say 90 degrees to the right, when I move the mouse right/left the model actually moves towards/from the camera, which is kind of logical considering camera x-axis now is world z-axis. Could someone please explain the best way to translate camera space mouse movements to world space so that the model always moves relative to the mouse movements regardless of the rotation/position of the camera? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
You have to transform the movement vector by the the camera rotation matrix.

In xna it would be something like:

positionVector += Vector3.transform(
right/left/etc vector,
matrix.createfromquaternion(camerarotationquaternion));

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement