-- online Search!

Scripting 3D in Flash: Panning the Camera

by senocular   | filed under 3D in Flash

Archive

This is an archived tutorial about Flash. It's kept for history and may reference outdated tech.

TL;DR

Panning the camera in Flash 3D doesn't really rotate the camera. Instead, you rotate everything in the scene around the camera on the x and z plane, with the y axis staying up. That plane works just like the familiar x, y plane, so you apply the same sine and cosine trig, swapping y for z.

  • Panning means spinning the z axis around until you face x, then back to z again, so the rotation lives entirely in x and z space.
  • Just like moving the camera earlier meant moving everything relative to it, rotating the camera means rotating the scene around it.
  • Seen from overhead, the x, z plane behaves like the x, y plane in almost every respect aside from the axis names, so trig applies directly.

This is an archived tutorial from the kirupa.com legacy collection. It covers software that may no longer be available, but it is kept online because the ideas still hold up.

Trigonometry can no be applied in Flash 3D to do some camera panning. This will involve trig to rotate the camera view or to determine in what direction the camera is pointing. Because the camera is looking straight back in z, in panning the camera, it would mean spinning the z axis around until you'd be looking at x, and from there, back to z again. The y axis remains up the whole time, so this rotation is based in the x and z axis space.

[ rotating around y axis ]

Basically, what this entails in terms of the camera is not really rotating the camera so much as rotating everything else in the 3D scene around the camera, just as with before when moving the camera, it wasn't so much moving the camera as it was moving everything in reference to it. The same thing applies in rotation as with movement. The application of that change, however, is a little different. It requires the use of trig.

[ panning camera vs panning items around camera ]

Now, in an overhead view the x, z plane, where the camera is being rotated within, the plane looks much like the x, y plane would normally. And technically, it pretty much is the same thing in almost every respect aside from the axis names. That means applying the sine and cosine methods there should be no problem. It's just a matter of replacing what was y with what will now be z - form x, y to x, z. With the rotation affecting that z axis you will get rotation around the camera view in 3D space as if the camera is panning left and right - exactly what we're after here. Now it's just a matter of putting what we know about trig to work for us in this way.

You may feel that you have learned everything there is to know about 3D in Flash, but there is still a bit more left.

Before you go, here are a few things you can do:

  1. Ask a question

    Stuck on something, or curious about a detail we skipped? Ask on the forums, and we’ll help you out.

That wraps up this tutorial. A huge thank you to all of you who buy kirupa's books, became a paid subscriber, watch the videos, and/or interact on the forums. Your support is what keeps writing like this online! 😇

senocular

This tutorial was written by senocular, also known as Trevor McCauley. He has been one of this community's most generous teachers since the early Flash days, and he is still around: find him on senocular.com and on the forums.

The KIRUPA Newsletter

Thought provoking content that lives at the intersection of design 🎨, development 🤖, and business 💰 - delivered weekly to over a bazillion subscribers!

SUBSCRIBE NOW

Creating engaging and entertaining content for designers and developers since 1998.

Follow:

Popular

Loose Ends

:: Copyright © KIRUPA 2026 //--