Menu
Samaritan's Purse

4

Add movement to the object.

EXAMPLE

4

INSTRUCTIONS

  1. 1
  2. 2
  3. 3
  4. Import event class import flash.events.Event;
  5. Listen for enter frame event addEventListener(Event.ENTER_FRAME, handleEnterFrame);
  6. Handle enter frame event private function handleEnterFrame(e:Event):void {}
  7. Rotate object one degree on Y axis object.yaw(1);
  8. Set material to double-sided material.doubleSided = true;

CODE

´╗┐package
{
    import flash.display.Sprite;
    import flash.events.Event;

    import org.papervision3d.cameras.Camera3D;
    import org.papervision3d.materials.ColorMaterial;
    import org.papervision3d.objects.primitives.Plane;
    import org.papervision3d.render.BasicRenderEngine;
    import org.papervision3d.scenes.Scene3D;
    import org.papervision3d.view.Viewport3D;

    public class Papervision3D4 extends Sprite
    {
        private var scene    :Scene3D;
        private var camera :Camera3D;
        private var viewport :Viewport3D;
        private var renderer :BasicRenderEngine;
        private var material :ColorMaterial;
        private var object :Plane;

        public function Papervision3D4()
        {
            scene = new Scene3D();

            camera = new Camera3D();

            viewport                 = new Viewport3D();
            viewport.autoScaleToStage = true;
            addChild(viewport);

            renderer = new BasicRenderEngine();

            material             = new ColorMaterial(0x000000);
            material.doubleSided = true;

            object = new Plane(material);
            scene.addChild(object);

            addEventListener(Event.ENTER_FRAME, handleEnterFrame);
        }

        private function handleEnterFrame(e:Event):void
        {
            object.yaw(1);

            renderer.renderScene(scene, camera, viewport);
        }
    }
}

Download