• Advertisement
Sign in to follow this  

rotating object with mouse

This topic is 3574 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 guys, I have a simple question. What is the standard way (a way that looks good) of rotating a 3d objct with the mouse. Basically I have euclidean rotation angles for the object and the change in mouse position each frae. How do I make a smooth rotation of the object where once the mouse button is released the object continues rotating. Any articles, links, code is much appreciated. -CProgrammer

Share this post


Link to post
Share on other sites
Advertisement
Use some kind of smoothing on the mouse positions (like splines).

Then produce a velocity vector for your mouse.

Something really primitive might work (mouse location now, and mouse location 0.1 seconds ago -- note the use of time, because you don't want to be dependent on sampling rates).

So now you have two points on the screen that don't suck completely that represent the velocity and direction the user moved the mouse.

Now, imagine a sphere and a line:

ooo
o o
o o
o + o
o / o
* o
/ ooo
/
/
--*-----------


Use that kind of projection to map your points on the screen to the sphere (except instead of circles and lines, we are talking spheres and planes).

Once you have done that, you have two points on your sphere. Use the difference as the angular velocity that the user wants to spin the sphere.

Now, doing this with Euler angles isn't easy -- if you are using matrix based orientations, it is much easier.

Share this post


Link to post
Share on other sites
Thanks for the insights.
matrix based does seem easier, so I think Ill go with that and then try to convert to euler angles.

-CProgrammer

Share this post


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

  • Advertisement