please help me…

Software: Other

RoliMoli, Newbie
Posted: 08 May 2013 04:18 PM   Total Posts: 10

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….

   

Avatar
80prozent, Sr. Member
Posted: 09 May 2013 04:10 PM   Total Posts: 430   [ # 1 ]

Hi

i think your problem is simply that you do not set any camera-position.
try something like that:

camera.y=200;
camera.x=200;
camera.lookAt(new Vector3D(0,0,0)); 

Hope that helps

 Signature 

sorry…i hope my actionscript is better than my english…

   

RoliMoli, Newbie
Posted: 10 May 2013 02:52 PM   Total Posts: 10   [ # 2 ]

hi 80prozent.
very thank for answer.
i test it certainly.
do you read my request.please recheck it and tell me which library is bet.
if i had any question about away3d or pv3d which resources are bet?

   

Avatar
80prozent, Sr. Member
Posted: 10 May 2013 03:28 PM   Total Posts: 430   [ # 3 ]

Hi again

ok.
what you want to do, you can do with all versions of Away3d.
forget about pv3d. this forum is about away3d.

Wich version of Away3d you should use really depends on the platforms that you are targeting.

there is Away3d 4.x that is using FlashPlayer 11.x

and there is Away3d 3.6 that is using FlashPlayer 10.x

Away3d 4.x makes use of the Stage3D, and offers much better performance than Away3d 3.6.

To use Away3d 4.1.1 crab the latest release from the download-site, and check the examples on github to get started.
http://www.away3d.com/download/
https://github.com/away3d/away3d-examples-fp11

If you are using Away3d 4.x you can use the new AwayBuilder-tool prepare you model.
http://www.away3d.com/awaybuilder/

If you are using Away3d 3.6 or Away3d 4.x you can use Prefab to prepare you models.
http://www.closier.nl/prefab/


Hope that helps

 

 

 Signature 

sorry…i hope my actionscript is better than my english…

   

RoliMoli, Newbie
Posted: 11 May 2013 01:30 PM   Total Posts: 10   [ # 4 ]

hi friend.
thanks.
i say again:
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?
just want to konw this.
i am new in away3d .but have problem by installing it in flashcs6.


thanks….

   

Avatar
80prozent, Sr. Member
Posted: 12 May 2013 12:27 PM   Total Posts: 430   [ # 5 ]

hi again.

OK here is the very simple answer:

YES - you can use Away3d for your project.

YES - in Away3D you can animate your camera

YES - you can make it look similar to your example


I would use the Away3d 4.1.1 version, thats available for download in the download section (see link in my previoius post)

To get this working in CS6, try finding a tutorial how to set up Away3d in CS6.

If you are on Windows, i would not use CS6 at all, but use FlashDevelop.
FlashDevelop is much better than CS6 for coding as3.
If you are on windows, and are willing to use Flashdevelop, i can tell you how to set up Away3d in Flashdevelop.
If you are not on windows, i cannot help you smile

cheers

robin

 Signature 

sorry…i hope my actionscript is better than my english…

   

RoliMoli, Newbie
Posted: 12 May 2013 01:17 PM   Total Posts: 10   [ # 6 ]

hi robin.
first thanks for your answers.
then i can using away3d 4.ok.

now i can work with away 3d 4 in flash cs6. don’t exist any problem.of course i should test flash develop that you said certainly.
but how can i drawing building and it’s room structures? for example when i want to draw a room (rooms have not up sides mean those are a cube that have not up side) , how should i draw it. i found any tuts but more of them was a cube that textured with a bitmap image for all sides. i think MaterialList isn,‘t in away3d 4. know you, i don’t understand which way i should use for draw a room cubes and building structure.exactly same pic that i said.

i want to draw five seperate cube(for bottom,front,back,left,right sides) but
was very difficult joining them together.
a room is a cube or a room is five cubes join together?
when i want do animates, should move camera or move/rotate objects?
what is your idea?
bist bald….

   

Avatar
80prozent, Sr. Member
Posted: 12 May 2013 02:26 PM   Total Posts: 430   [ # 7 ]

hi

the creation of the builing by code would be very difficult.

You will need to use some kind of 3d-application (c4d/3dsMax/Blender/Maya) to create you building.

After you created your Building in a 3d-Application, you can export it and load it into AwayBuilder or Prefab to prepare for use in Away3d.

For a project like this, i think it makes sense to have a static building and a moving camera.

 Signature 

sorry…i hope my actionscript is better than my english…

   

RoliMoli, Newbie
Posted: 14 May 2013 06:50 PM   Total Posts: 10   [ # 8 ]

hi.
what do you think about this? i working it as this figure.
http://dotnetboy.zgig.ir/my.jpg
is good? or ...?
have you any idea for this case? please tell me any resource or same work if you know.
thanks
specially robin.

   

Avatar
Fabrice Closier, Administrator
Posted: 14 May 2013 08:54 PM   Total Posts: 1265   [ # 9 ]

Just a little note “en passant”, know that there are classes in extrusion package that might interrest you. Not only they would simplify your work by doing all the constructs, but they’ll also map the uv’s for you.
For instance, passing the base 4 points and top 4 to SkinExtrude, would build all the sides for you right away. No need to work at triangle level…

   

RoliMoli, Newbie
Posted: 15 May 2013 09:52 AM   Total Posts: 10   [ # 10 ]

hi friend.
i don’t understand your mean. please describe me more.what is extrusion package? what is skinExtrude?
thank you….

   

Avatar
Fabrice Closier, Administrator
Posted: 15 May 2013 10:43 AM   Total Posts: 1265   [ # 11 ]

https://github.com/away3d/away3d-core-fp11/tree/master/src/away3d/extrusions

SkinExtrude, generates a mesh from start and end points.

   

RoliMoli, Newbie
Posted: 16 May 2013 07:11 AM   Total Posts: 10   [ # 12 ]

hi.
thank.
i found about extrusions on google but some of them were for away 3.6 or older some of them get depracted error.
can you write sample of using extrusions in away3d 4?
i don’t know how using it really.
....

   

RoliMoli, Newbie
Posted: 18 May 2013 12:22 PM   Total Posts: 10   [ # 13 ]

i found about pathextrude.
and write any code. my code is:

package  {
 
 import flash
.display.Sprite;
 
import away3d.containers.View3D;
 
import away3d.containers.Scene3D;
 
import away3d.cameras.Camera3D;
 
import away3d.primitives.CubeGeometry;
 
import away3d.extrusions.PathExtrude;
 
import away3d.animators.PathAnimator;
 
import away3d.paths.CubicPath;
 
import flash.geom.Vector3D;
 
import away3d.entities.Mesh;
 
import away3d.animators.UVAnimator;
 
import away3d.animators.UVAnimationSet;
 
import away3d.materials.ColorMaterial;
 
import flash.events.Event;
 
 
[SWF(width=800,height=600,frameRate=60,backgroundColor=0xFFFFFF)]
 
public class TestExtrusion extends Sprite{
  
  
private var view:View3D;
  private var 
scene:Scene3D;
  private var 
cam:Camera3D;
  private var 
cubePath:CubicPath;

  public function 
TestExtrusion() {
   
//seup my scene
   
view=new View3D();
   
scene=view.scene;
   
cam=view.camera;
   
addChild(view);
   
init();
   
  
}
  
  
  
private function init():void{
   
var aPoints [];
   
//here a U form
   
aPoints.push(new Vector3D(-10000));
   
aPoints.push(new Vector3D(-5000));
   
aPoints.push(new Vector3D(-50, -500));
   
aPoints.push(new Vector3D(0, -500));
   
aPoints.push(new Vector3D(50, -500));
   
aPoints.push(new Vector3D(5000));
   
aPoints.push(new Vector3D(10000));
   
    var 
pathData:Vector.<Vector3D> = Vector.<Vector3D>([
     
new Vector3D(-5000,0),
     new 
Vector3D(-250100,0),
     new 
Vector3D(250100,0),
     new 
Vector3D(5000,0),
    
     new 
Vector3D(5000,0),
     new 
Vector3D(750, -100,0),
     new 
Vector3D(850, -100,0),
     new 
Vector3D(10000,0)
     
]);
     
      var 
profile:Vector.<Vector3D> = Vector.<Vector3D>([new Vector3D(-100, -500),
                new 
Vector3D(-100500),
              new 
Vector3D(0500),
              new 
Vector3D(100500),
              new 
Vector3D(10000),
              new 
Vector3D(100, -500),
              new 
Vector3D(0, -500),
              new 
Vector3D(-100, -500)
                
]);
   
   var 
mat:ColorMaterial=new ColorMaterial(0xFF0000);
 
   
cubePath=new CubicPath(pathData);
   
   var 
pe=new PathExtrude(mat,cubePath,profile,10);
   
pe.coverSegment=true;
   
pe.smoothSurface=true;
   
   
scene.addChild(pe);
   
view.render();
  
  
}
  
 }
 

but get me these error from PathExtrude.as file:
Warning: 3602: ‘getPointsOnCurvePerSegment’ has been deprecated.
Warning: 3602: ‘getSegmentAt’ has been deprecated.
Warning: 3602: ‘numSegments’ has been deprecated.
Warning: 3602: ‘getPointsOnCurvePerSegment’ has been deprecated.
Warning: 3602: ‘numSegments’ has been deprecated.

what is problem?
ween i get this errors on C#.net i understand that this class is obsolete.
but it was just a warning no error.
but here i don’t see output.
is that’s mean here too?

 

 

 

   

RoliMoli, Newbie
Posted: 19 May 2013 07:05 PM   Total Posts: 10   [ # 14 ]

hi.
i finally can to work with extrudes with your helps.
now i need to draw shape same this:
http://dotnetboy.zgig.ir/req.jpg

i try to draw it with extrudes.
my tries is this :
http://dotnetboy.zgig.ir/draw.jpg
two side with 90 degree i drawn by linearExtrude and the arc side i drawn by
pathExtrude.

the code lines are :

[SWF(width=800,height=600,frameRate=60,backgroundColor=0xFFFFFF)]
 
public class TestExtrusion extends Sprite{
  
  
private var view:View3D;
  private var 
scene:Scene3D;
  private var 
cam:Camera3D;
  private var 
cubePath:CubicPath;
  private var 
pe:PathExtrude;
  private var 
le:LinearExtrude;
  private var 
lastKey:uint;
     private var 
keyIsDown:Boolean false;
  
  private var 
hoverCam:HoverController;

  public function 
TestExtrusion() {
   
//seup my scene
   
view=new View3D();
   
scene=view.scene;
   
cam=view.camera;
   
cam.z=-800;
   
   
   
addChild(view);
   
init();
   
  
}
  
  
  
private function init():void{
   
   
   
var lineData:Vector.<Vector3D> = Vector.<Vector3D>([
     
new Vector3D(0,0,0),
     new 
Vector3D(0,-100,0),
     new 
Vector3D(-100,-100,0)

   
]);
   
   
    var 
pathData:Vector.<Vector3D> = Vector.<Vector3D>([
   
     
new Vector3D(0,0,0),
     new 
Vector3D(-100,0,0),
     new 
Vector3D(-100,-100,0)
     
   
     
]);
     
      var 
profile:Vector.<Vector3D> = Vector.<Vector3D>([

                  
  
new Vector3D(-50, -100),
                new 
Vector3D(-50100),
              new 
Vector3D(0100),
              new 
Vector3D(50100),
              new 
Vector3D(5000),
              new 
Vector3D(50, -100),
              new 
Vector3D(0, -100),
              new 
Vector3D(-50, -100)
                
]);
    
    
    
   
   var 
mat:ColorMaterial=new ColorMaterial(0xFF0000);
   
   
   
   var 
qPath=new QuadraticPath(pathData);
   
pe=new PathExtrude(mat,qPath,profile,10,true);
   
pe.z=50;
   
le=new LinearExtrude(mat,lineData,LinearExtrude.Z_AXIS,100,20,true,5,3,null,false,false);
   
   
pe.coverSegment=true;
   
pe.smoothSurface=true;
   
pe.coverAll=true;
   
pe.flip=true;
   
   
hoverCam=new HoverController(cam,pe,0,0);
   
hoverCam.distance 600;
   
hoverCam.steps 0;
   
hoverCam.yFactor=1;
   
   
scene.addChild(pe);
   
scene.addChild(le);
   
addEventListener(Event.ENTER_FRAME,onEnter);
   
this.stage.addEventListener(KeyboardEvent.KEY_DOWN,kd);
   
this.stage.addEventListener(KeyboardEvent.KEY_UP,ku);
   
  
  
}
  
  
private function onEnter(e:Event):void
  {
   
   
if(keyIsDown){
            
// if the key is still pressed, just keep on moving
            
switch(lastKey){
                
case 87    hoverCam.tiltAngle -= 2; break;
                case 
83    hoverCam.tiltAngle += 2; break;
                case 
65    hoverCam.panAngle -= 2; break;
                case 
68    hoverCam.panAngle += 2; break;
                case 
Keyboard.UP hoverCam.distance -= 5; break;
                case 
Keyboard.DOWN hoverCam.distance += 5; break;
            
}

        }

   view
.render();
  
}
  
  
private function kd(e:KeyboardEvent):void
  {
   lastKey 
e.keyCode;
   
   
keyIsDown true;
  
}
  
private function ku(e:KeyboardEvent):void
  {
   keyIsDown 
false;
  
}
  
  
  
 } 

if you see the result(http://dotnetboy.zgig.ir/draw.jpg), you can see arc line thickness have problem.i signed they with two white circles.
first question : is this true way to drawing my requested shape(http://dotnetboy.zgig.ir/req.jpg)?
and second : how can i solve thickness of arc line side same two lineaerExtrude lines?
thanks for your time….

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X