Menu
Samaritan's Purse

DEBUGCAMERA3D

DebugCamera3D is Camera3D with mouse control, keyboard control, and display information.

EXAMPLE

DebugCamera3D

KEYBOARD CONTROL

W forward
S backward
A left
D right
Q rotationZ -
E rotationZ +
R fov +
F fov -
T near +
G near -
Y far +
H far -

INSTRUCTIONS

  1. Import import org.papervision3d.cameras.DebugCamera3D;
  2. Declare private var camera :DebugCamera3D;
  3. Initialize camera = new DebugCamera3D(viewport3D, fovY, near, far);
    PARAMETER DEFAULT DESCRIPTION
    viewport3D NONE viewport to render
    fovY 90 field of view vertical degree
    near 10 clipping plane near distance
    far 5000 clipping plane far distance

CODE

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

    import org.papervision3d.cameras.DebugCamera3D;
    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 Papervision3DDebugCamera3D extends Sprite
    {
        private var scene    :Scene3D;
        private var viewport :Viewport3D;
        private var camera :DebugCamera3D;
        private var renderer :BasicRenderEngine;
        private var material :ColorMaterial;
        private var object :Plane;

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

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

            camera = new DebugCamera3D(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
        {
            renderer.renderScene(scene, camera, viewport);
        }
    }
}

Download

Papervision3D Official Documentation