Scripting 3D in Flash
      by senocular

Panning the Camera
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.

 




SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple.