# rotating object with mouse

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

## 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 on other sites
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 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

1. 1
2. 2
3. 3
4. 4
Rutin
12
5. 5

• 12
• 16
• 10
• 14
• 10
• ### Forum Statistics

• Total Topics
632659
• Total Posts
3007692
• ### Who's Online (See full list)

There are no registered users currently online

×