Director 3D > 3D Cameras |
What is a camera > Simple control using the 3D window > > Moving/camera viewpoints > Useful links |
Camera Control via Lingo |
While the Director 3D window is good for viewing the contents of a 3D cast member and moving the world's primary camera, Lingo provides more flexibility and control. Here is an example of a Lingo controlled camera rotation around a 3D object:
Note that it is the CAMERA that is rotating around the object's centre point and not the other way round (notice that the light source is constantly on the same area of the model?). The following diagram illustrates the path of the camera around the object.
This is the code that controls the camera:
As you can see, it's very simple. on enterFrame This means that the code is executed on every frame - meaning that it is constantly working as long as this section of movie is playing. pCamera.rotate(0,0,1, pModel) pCamera is the variable name of the camera. rotate is a Lingo transformation function, we pass it the values (xAngle, yAngle, zAngle, and the point around which to rotate (the relativeTo value ) - in this example pModel means is the model we are rotating around) end This end the section of code Compare this to the following example, where the camera stays still and the OBJECT rotates around its centre point (the model is also getting illuminated on all sides as it turns to face the light). This is Lingo controlling the rotation of the model itself:
An excellent example of camera control can be found at Dean’s Director Pages The source file for the above example of camera rotation can be found here. |
What is a camera > Simple control using the 3D window > > Moving/camera viewpoints > Useful links |
July 2003 |