Example 1 - Rotating a Transparent Cube

3D drawing and manipulating 3D objects is a vast and complex subject. In this easy tutorial, we show simple techniques of dynamically drawing and rotating 3D objects in ActionScript 3.

We begin with simple polygonal objects and end with a parametric surface in 3D. We explain the mathematics behind creating different views of those 3D objects. In our model, the object remains stationary and the observer moves. The position of the observer is determined by two angles corresponding to a horizontal and vertical rotation of the observer.

In the two pages that follow, we explain mathematics behind rotation and rendering different views of a 3D object and discuss the code for the simple applet above. If you like to delve directly into the code, download the fla file below.

Download

The fla file linked below contains complete, exhaustively commented source code for the Flash movie above. We will discuss the code on page 3 of this tutorial. But first, let's discuss mathematics behind rotating the cube. Please, turn the page.

Back to Advanced and Experimental              Back to Flash and Math Home

We welcome your comments, suggestions, and contributions. Click the Contact Us link below and email one of us.

Adobe®, Flash®, ActionScript®, Flex® are registered trademarks of Adobe Systems Incorporated.