There are several ways one can interact with Flash and Papervision3D applications. In this chapter, we will focus on mouse interaction and keyboard interaction. We will deal with keyboard interaction in the example at the end of this chapter. However, in this section, we will discuss some mouse interaction tricks—short pieces of code that you simply can put in the render method. When the user moves the mouse, this code will animate the camera or the object(s) in your scene. We will also take a look at how to orbit the camera around an object. Orbiting is moving the camera around an object over spherical coordinates, while keeping a constant distance to the object.
In order to demonstrate a sample of mouse interaction techniques, we will create a template class on which we will base the examples. Because we will make the mouse interact with a grid of planes, we will first build a grid as shown in the following screenshot:
Place the following code in your document class...