2
Add an object to the scene.
Example
Instructions
- 1
- Import object class
import org.papervision3d.objects.primitives.Plane;
- Declare object
private var object :Plane;
- Initialize object
object = new Plane();
- Add object to scene
scene.addChild(object);
- Set viewport size to stage size
viewport.autoScaleToStage = true;
Code
package { import flash.display.Sprite; import org.papervision3d.cameras.Camera3D; import org.papervision3d.objects.primitives.Plane; import org.papervision3d.render.BasicRenderEngine; import org.papervision3d.scenes.Scene3D; import org.papervision3d.view.Viewport3D; public class Papervision3D2 extends Sprite { private var scene :Scene3D; private var camera :Camera3D; private var viewport :Viewport3D; private var renderer :BasicRenderEngine; private var object :Plane; public function Papervision3D2() { scene = new Scene3D(); camera = new Camera3D(); viewport = new Viewport3D(); viewport.autoScaleToStage = true; addChild(viewport); renderer = new BasicRenderEngine(); object = new Plane(); scene.addChild(object); renderer.renderScene(scene, camera, viewport); } } }