public class away3DBasico_v003 extends Sprite
{
public var view:View3D = new View3D();
public var plano1:PlaneGeometry = new PlaneGeometry(100,100,1,1,true);//false indica si el plano esta acostado o parado
public var plano2:PlaneGeometry = new PlaneGeometry(100,100,1,1,true);//estos dos estaran de huevones acostados
public var plano3:PlaneGeometry = new PlaneGeometry(100,100,1,1,false);
public var plano4:PlaneGeometry = new PlaneGeometry(100,100,1,1,false);
public var plano5:PlaneGeometry = new PlaneGeometry(100,100,1,1,false);
public var plano6:PlaneGeometry = new PlaneGeometry(100,100,1,1,false);
private var plano_m1:ColorMaterial;
private var plano_m2:ColorMaterial;
private var plano_m3:ColorMaterial;
private var plano_m4:ColorMaterial;
private var plano_m5:ColorMaterial;
private var plano_m6:ColorMaterial;
public var malla1:Mesh;
public var malla2:Mesh;
public var malla3:Mesh;
public var malla4:Mesh;
public var malla5:Mesh;
public var malla6:Mesh;
//public var vector3d:Vector3D = new Vector3D(5,5,0,1);
public var contenedor:ObjectContainer3D =new ObjectContainer3D();
public function away3DBasico_v003()
{
view.backgroundColor= 0xB0C4DE;
plano_m1= new ColorMaterial(0x000fff);
plano_m2= new ColorMaterial(0xfff000);
plano_m3= new ColorMaterial(0xffcc00);
plano_m4= new ColorMaterial(0x909090);
plano_m5= new ColorMaterial(0x008000);
plano_m6= new ColorMaterial(0xff0000);
malla1 = new Mesh(plano1,plano_m1);
malla2 = new Mesh(plano2,plano_m2);
malla3 = new Mesh(plano3,plano_m3);
malla4 = new Mesh(plano4,plano_m4);
malla5 = new Mesh(plano5,plano_m5);
malla6 = new Mesh(plano6,plano_m6);
addChild(view);
malla1.y+=50;//cara superior
malla2.rotationZ=180;malla2.y-=50;//cara inferior
malla3.z-=50;//cara frontal
malla4.rotationY=180;malla4.z+=50//cara atras
malla5.rotationY=90;malla5.x=-50; //cara derecha
malla6.rotationY=270;malla6.x=50; //cara izquierda
view.camera.y+=100;
view.camera.z+=300;
contenedor.addChild(malla1);
contenedor.addChild(malla2);
contenedor.addChild(malla3);
contenedor.addChild(malla4);
contenedor.addChild(malla5);
contenedor.addChild(malla6);
view.scene.addChild(contenedor);
contenedor.pivotPoint = new Vector3D(0,1,0);
this.addEventListener(Event.ENTER_FRAME, loop);
}
public function loop(e:Event):void
{
contenedor.rotationY+=1;
view.camera.y = 3 * (stage.mouseY - stage.stageHeight/2);
view.camera.x = -3 * (stage.mouseX - stage.stageHeight/2);
view.render();
}
}