views:

112

answers:

3

I need to allow the user to pan, rotate, zoom in/out of my scene in 3D which uses a parallel projection. Panning and zooming in/out has been pretty straight forward. However, when using the mouse for rotation, I am not sure what to use as the center of rotation. In particular, I am not sure at what depth inside the screen the center of rotation should fall.

Here is what I am doing right now: Take the centroid of the model and use that as the center of rotation. However, the centroid can at times fall outside the visible area (as a result of panning and the zoom level) and the user (and I myself) find it counterintuitive to rotate the model around a point we cannot see.

What is considered the standard for user-interaction in such a case? What could be the most intuitive behaviour here?

PS: I have only one view port (unlike Blender and friends).

Edit: It would be great if experienced parties could evaluate current practices in packages such as Google SketchUp and Blender 3D and post their opinions.

+1  A: 

I've seen a few solutions here, my favourite being to allow the user to set (and drag with the mouse) the center of rotation. You then grab a point on the model and drag to rotate about this centre. Less good but workable is the center of the viewport back projected into model coordinates.

Shane MacLaughlin
I prefer the first approach too, however my users are a non-technical bunch and might not appreciate it. I've been looking at Google's Sketchup. Their orbit tools looks like what I'm looking for.
Vulcan Eager
A: 

I'm not sure if they like this better... but try to make the rotation rotate the camera, make it like the ones in first person shooter games. This might not go well with the mouse rotation idea but it is one of the most used and should be intuitive within seconds of use for the user.

jghost
+2  A: 

You could try casting a ray from the camera towards the center of the screen, finding the nearest and furthest intersections, then set the point of rotation at the midpoint of the intersection points.

Winder