# 3D Camera control in DCC

I'm trying to build a simple world editor and I would like to implement a camera similar to what's used in 3ds Max, Maya or even Unity.

From what I can figure out from Unity, the panning behavior seems to be relatively simple : the camera is moving on the plane defined by the camera position and direction. However, rotation is more complex. Most of the time, the camera is looking at a fixed point on the xz plane and rotating around it. I'm not entirely sure how this point is determined and this is what I'm trying to find out. Also, I've noticed that, after a certain height, the camera fall back to a rotation-only control.

Does anybody implemented something similar to this?

-
Why not ask on the UnityAnswers? – Arcane Engineer Aug 4 '11 at 18:38
Maybe, but I'm using Unity as an example. UnityAnswers, as I understand it, is for asking question about development in Unity, not about development of Unity. – subb Aug 4 '11 at 18:48
Yep, right, my bad. – Arcane Engineer Aug 4 '11 at 19:30

It seems to me that how the point is determined is really up to you. You could set the initial point to be the centre of your world and then set your camera up with an appropriate angle and distance looking at that point.

• Panning would move the camera AND the point.
• Rotating, as you said, would rotate the camera around it.
• Zooming would move the camera closer to the point along the "target" vector of the camera to the point.

Doing it this way allows you to focus and rotate around a specific object within the world.

Some other options:

• Display the point so the user knows what they're rotating around/looking at
• Tether it to the ground of the world (if applicable/possible)

You seem to understand how the other tools work with the exception of figuring out the point. So, I would say just implement the point in a way that makes sense and works for your world editor.

-
Yes you are probably right. I think I've found a good way to do it : I create a ray of a specific length from the camera position and direction. If the ray intersect with the ground, the intersection point becomes my pivot point. If not, I use the end of the ray. – subb Aug 4 '11 at 20:55
@Subb - That sounds to me like a good way to do it.:) – Richard Marskell - Drackir Aug 5 '11 at 2:07