i hope you can help me.
i want to create a 3d view of a building in flash same this
http://dotnetboy.zgig.ir/p1.jpg
of course i want to be dynamic.for example user can zoom and rotate camera view.
can i do it with flash 3d libraries?
if yes which is the best?
if no what is your idea?
of course i should to say that i using pv3d now but have a problem with it:
i want to draw a room view but output is:
http://dotnetboy.zgig.ir/out.jpg
why?
this is my code:
package {
import flash.display.MovieClip;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.objects.primitives.Cube;
import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.materials.utils.MaterialsList;
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.view.Viewport3D;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.materials.MovieMaterial;
import flash.events.Event;
import flash.filters.BlurFilter;
import flash.display.Stage;
public class Main extends MovieClip {
public var view:Viewport3D;
public var renderer:BasicRenderEngine;
public var scene:Scene3D;
public var cube:Cube;
public var cam:Camera3D;
public function Main() {
var grayMaterial : ColorMaterial=new ColorMaterial(0x33cc99);
var materialList:MaterialsList=new MaterialsList();
materialList.addMaterial(grayMaterial,"front");
materialList.addMaterial(grayMaterial,'back');
materialList.addMaterial(grayMaterial,'left');
materialList.addMaterial(grayMaterial,'right');
materialList.addMaterial(grayMaterial,'top');
materialList.addMaterial(grayMaterial,'bottom');
var Material2 : ColorMaterial=new ColorMaterial(0x99cc33);
var materialList2:MaterialsList=new MaterialsList();
materialList2.addMaterial(Material2,"front");
materialList2.addMaterial(Material2,'back');
materialList2.addMaterial(Material2,'left');
materialList2.addMaterial(Material2,'right');
materialList2.addMaterial(Material2,'top');
materialList2.addMaterial(Material2,'bottom');
//movie material
//var logoMaterial:MovieMaterial = new MovieMaterial( new myMovie() );
// //replace "ActiveTutsLogo" above with the Class name of your movie clip
// var materialsList:MaterialsList = new MaterialsList();
// materialsList.addMaterial( logoMaterial, "front" );
// materialsList.addMaterial( logoMaterial, "back" );
// materialsList.addMaterial( logoMaterial, "left" );
// materialsList.addMaterial( logoMaterial, "right" );
// materialsList.addMaterial( logoMaterial, "top" );
// materialsList.addMaterial( logoMaterial, "bottom" );
scene = new Scene3D();
//new drawing
var backCube:Cube=new Cube(materialList,800,25,500);
backCube.x=0;
backCube.y=0;
var bottomCube :Cube=new Cube(materialList2,800,500,25);
bottomCube.y=-250;
//bottomCube.rotationX=80;
var topCube :Cube=new Cube(materialList2,800,500,25);
topCube.y=250;
var rightCube :Cube=new Cube(materialList,25,500,500);
//topCube.rotationX=100;
rightCube.x=400;
var leftCube:Cube=new Cube(materialList,25,500,500);
//leftCube.rotationX=0;
// leftCube.rotationY=0;
// leftCube.rotationZ=0;
leftCube.x=-400;
//leftCube.y=250;
//var backCube:Cube=new Cube(materialList,750,50,250);
// backCube.z=180;
// backCube.y=200;
//
// var bottomCube :Cube=new Cube(materialList,800,25,500,10,10,10);
// bottomCube.rotationX=80;
//
// var topCube :Cube=new Cube(materialList,800,25,500,10,10,10);
// topCube.rotationX=100;
// topCube.y=400;
//
//
// var leftCube:Cube=new Cube(materialList,500,25,400);
// leftCube.rotationX=0;
// leftCube.rotationY=0;
// leftCube.rotationZ=0;
// leftCube.x=-400;
// leftCube.y=250;
//cube=new Cube(materialList);
//cube.rotationX=-10;
// cube.rotationY=40;
//cube.rotationZ=10;
cam=new Camera3D();
//cam.x=0;
// cam.y=225;
// cam.z=-800;
//cam.focus=10;
scene.addChild(backCube);
scene.addChild(rightCube);
scene.addChild(leftCube);
scene.addChild(bottomCube);
scene.addChild(topCube);
//add more cubes
//for(var i:int=0;i<3;i++)
// {
// cube = new Cube(materialList);
// cube.x =i*350;
// cube.scale=0.40; // cube.rotati // cube.rotati
// scene.addChild(cube);
// }
view=new Viewport3D();
view.autoScaleToStage=true;
addChild(view);
renderer = new BasicRenderEngine();
renderer.renderScene(scene,cam,view);
//var fil:BlurFilter=new BlurFilter();
// cube.filters=[fil];
addEventListener(Event.ENTER_FRAME,on_ef);
}
private function on_ef(evt:Event):void
{ //cube.rotati +5; //cube.rotati +5; //cube.rotati +5;
// renderer.renderScene(scene,cam,view);
}
}
}
thanks….