Ok, we need to place the observer or camera in some place in our 3D space. In this example i've used a fixed camera, it means we are not going to move the camera. Anyway, we are moving the 3D object.


//Lens distance var fl:Number = 400; //Center of the Stage var vpX:Number = Stage.width/2; var vpY:Number = Stage.height/2; //Render Offsets, here you can move the 3D object var xOffset:Number = 0; var zOffset:Number = fl; var yOffset:Number = 0; //vars used to rotate the cube in the Y and X axis var angleY:Number = 0.01; var angleX:Number = 0.01; var angleZ:Number = 0.01; } //We call the cube function generateCube();

    This is our first code, don't forget to write the generateCube function.
   
    Camera is placed in the space using just the z axis, cos we asume is at x=0 and y=0. At the Z axis we use the var fl. You can change it to see the differences.

   Our model will be placed in the middle of the screen defined with vpX and vpY vars.

    Since we want to move our cube, we also need to declare the axis offset, and we use xOffset, yOffset and zOffset. For cube rotation, we also have the angleX, angleY and angleZ vars. I've used 0.01, to get an initial rotation in the 3 axis when the example loads.