Search code examples
flashpapervision3daxescoordinate

Papervision3D Coordinate Axes


I have a flash application and I use papervision3d library. I put my objects to the scene, no problem but I also want to show the coordinate axes (x,y and z) to user. Is there any way to show these axes?


Solution

  • That would be the UCS object:

    scene.addChild(new UCS());
    

    Here's a very basic example:

    package {
        import flash.display.Sprite;
        import flash.events.Event;
        import org.papervision3d.view.*;
        import org.papervision3d.objects.*;
        import org.papervision3d.objects.primitives.*;
        import org.papervision3d.objects.special.*;
    
        public class HelloPV3D extends Sprite {
    
            private var view:BasicView;
    
            public function HelloPV3D()  {
                view = addChild(new BasicView()) as BasicView;
                view.scene.addChild(new UCS());
                view.scene.addChild(new Sphere());
                this.addEventListener(Event.ENTER_FRAME,update);
            }
            private function update(e:Event):void{
                view.camera.orbit(mouseY/stage.stageHeight,mouseX/stage.stageWidth,false);
                view.singleRender();
            }
        }
    }
    

    UCS Demo