papervision3d 中的坐标(1)--坐标系

来源:互联网 发布:雍正知乎 编辑:程序博客网 时间:2024/05/16 01:03

papervision坐标系如图:

 

 

 

例子:

 

代码:

 

public class My3D extends BasicView
 {
  private var sphere:Sphere
  public function My3D()
  {
      super(800,800,false,true,CameraType.FREE);
      sphere = new Sphere(null,200,20,20);
   
                 var lines:Lines3D = new Lines3D();//虚拟一根线
                 lines.addNewLine(2, -400, 0, 0, 400, 0, 0); //加入线,当作x轴
                 lines.addNewLine(2, 0, -400, 0, 0, 400, 0); //当作y轴
                 lines.addNewLine(2, 0, 0, -400, 0, 0, 400); //当作z轴
              
          scene.addChild(sphere);
         // sphere.addChild(lines); //坐标轴和园一期转动
          scene.addChild(lines);
        
         camera.position=new Number3D(400,400,400);
         camera.lookAt(sphere);
      startRendering();
  }
        /**
         * 加入每一帧的动作
         * @param event
         *
         */
        override protected function onRenderTick(event:Event=null):void
  {
   //sphere.yaw(2);//绕Y轴选装
   //sphere.roll(2);//绕x轴选装
    sphere.pitch(2);//绕z轴选装
   
   renderer.renderScene(scene, camera, viewport);
  }

 

 

  • Pv3DHelloWorld.zip (14.9 KB)
  • 下载次数: 50