Technology

Papervision3D Planeの回転

Papervision3Dの簡単な練習。10枚のPlaneを横方向に回転させます。

package
{
  import flash.events.Event;
  import org.papervision3d.materials.ColorMaterial;
  import org.papervision3d.objects.primitives.Plane;
  import org.papervision3d.view.BasicView;
 
  public class test001 extends BasicView{
 
    protected var planes:Array;
 
    public function test001():void{
      var colorMaterial:ColorMaterial;
      var plane:Plane;
      planes=new Array();
 
      for(var i:int;i<10;++i){
        colorMaterial = new ColorMaterial(0x0000FF, 0.5);
        colorMaterial.doubleSided = true;
        plane = new Plane(colorMaterial, 100, 100);
        plane.x=50*(i-5);
 
        planes.push(plane);
        scene.addChild(plane);
      }
 
      startRendering();
    }
 
    override protected function onRenderTick(event:Event = null):void{
      super.onRenderTick(event);
 
      for(var i:int;i<10;++i){
        planes[i].yaw(i);
      }
    }
  }
}

Topic