Imported 3D Mesh movement

Software: Away3D 4.x

christiancillo, Newbie
Posted: 22 January 2013 10:53 PM   Total Posts: 8

Hi everyone!

I’m new at this, so forgive me if i’m asking questions already answered (i’m sure), butI’m having trouble with a mesh i have imported to my project.

I try to move it forward whenever the up key is pressed, but then only a part of the model moves. It’s a car, and the only thing that moves is the wheel rims.

This is what i do to load and to try and move the car:

private function addCar():void
  {
  Parsers.enableAllBundled();
  var parseador:AssetLoaderContext = new AssetLoaderContext();
  Loader3D.enableParser(Max3DSParser);
 
  meshLd = new Loader3D();
  meshLd.addEventListener(AssetEvent.ASSET_COMPLETE, meshLdHandler);
  meshLd.load( new URLRequest(“audi/a4_a.3DS”), parseador);
   
  }
 
  private function meshLdHandler(e:AssetEvent):void
  {
  if(e.asset.assetType == AssetType.MESH)
  {
  car = e.asset as Mesh;
  car.position = new Vector3D(50,0,5);
  car.geometry.scale(20)
 
 
  camCnt = new HoverController(cam,car);
  camCnt.distance = 100;
  camCnt.minTiltAngle = 0;
  camCnt.maxTiltAngle = 90;
  camCnt.panAngle = 0;//45
  camCnt.tiltAngle = 20;
 
  scene.addChild(car);
 
 
  }
private function kbHandler(e:KeyboardEvent):void
  {
  if(e.keyCode == Keyboard.UP)
  {
    car.moveForward(1);
 
  }
  }

I’ve looked for some example of how to accomplish this, but no luck so far. Hope you guys can help. Thank you!!!

   

christiancillo, Newbie
Posted: 24 January 2013 11:38 AM   Total Posts: 8   [ # 1 ]

I’m still trying to make this work, if someone knows a way pleaseeee post here!!!

   

Rasterizer, Member
Posted: 24 January 2013 06:29 PM   Total Posts: 69   [ # 2 ]

Did you have a proper good look at the examples ?

The loaded model may consist of SEVERAL MESHES and your parsing listener is assigning them one by one to your Car variable. So your rims are loaded last and therefore are movable.

What you should do is to addChild those loaded meshes to some empty object and move that one instead.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X