Articles tagged with: create
Code Samples, Flash, Tutorials »
Here’s a class that renders a simple wireframe sphere in Papervision3d, and allows the mouse to control the pitch and yaw. This example can be applied to any simple interactive environment.
package {
import flash.display.Sprite;
import flash.events.Event;
import org.papervision3d.cameras.*;
import org.papervision3d.objects.*;
import org.papervision3d.scenes.*;
import org.papervision3d.materials.*;
public class PaperVisionTest extends Sprite {
/** setup the container */
private var container: Sprite = new Sprite();
/** setup the scene */
private var scene: MovieScene3D = new MovieScene3D(container);
/** setup the camera */
private var camera: Camera3D = new Camera3D();
/** setup the material */
private var material:WireframeMaterial = new WireframeMaterial(0xFF0000);
/** setup the sphere */
private var sphere:Sphere = new …
Code Samples, Flash, Tutorials »
Here’s a simple scene that renders a Papervision3d scene within a container. There are no 3d elements added, but this is as simple as it gets.
import org.papervision3d.cameras.*;
import org.papervision3d.objects.*;
import org.papervision3d.materials.*;
import org.papervision3d.scenes.*;
var container:Sprite = new Sprite();
addChild(container);
container.x = stage.stageWidth * 0.5;
container.y = stage.stageHeight * 0.5;
var scene:Scene3D = new Scene3D(container);
var camera:Camera3D = new Camera3D();
camera.zoom = 11;
addEventListener(Event.ENTER_FRAME, loop);
function loop(e:Event):void
{
scene.renderCamera(camera);
}
If you’re interested in how this can be improved, check out the next post with a more elaborate Papervision scene.








