Multiple collada models in same ObjectContainer?

Software: Away3D 4.x

orkman, Newbie
Posted: 07 October 2012 05:41 AM   Total Posts: 9

Hi, I am new to Away3D but enjoying it! Got several models loading onto the stage.

But, is there a way to load multiple collada models into a single ObjectContainer3D? Like a group of models in a single container so I can make actionscript calls to just that container?

Also, can anyone provide gesture code on how to rotate the container on the Y axis for iPad with a swipe? Thanks!

   

Avatar
alihm, Jr. Member
Posted: 07 October 2012 12:28 PM   Total Posts: 49   [ # 1 ]

ObjectContainer3D has an addChild() method. It’s kinda like MovieClip of the Away3D. you can addChild other models into it. So you can do these:

_myObjectContainer3D.addChild( another_ObjectContainer3D_object );
or
_myObjectContainer3D.addChild( some_Mesh_object );
...

   

orkman, Newbie
Posted: 07 October 2012 03:21 PM   Total Posts: 9   [ # 2 ]

Thanks Mahdavi, I am still a little stuck on the loading functions. I am using the “cow” Collada tutorial. There is probably a better way.

  protected function loadModel():void
  {
  var loader3D:Loader3D = Collada.load(“daeModel/magazine.dae”);
  var loader3Db:Loader3D = Collada.load(“daeModel/barrel2.dae”);
  loader3D.addChild(loader3Db);
  loader3D.addEventListener(Loader3DEvent.LOAD_SUCCESS, onModelLoadSuccess);
  }

  protected function onModelLoadSuccess(event:Loader3DEvent):void
  {
  cow = event.loader.handle as ObjectContainer3D;
  cow.scale(5);
  cow.moveDown(1);
  view.scene.addChild(cow);
  }

It will load the first object fine, but it can’t “see” the second one.

   

Avatar
alihm, Jr. Member
Posted: 07 October 2012 05:47 PM   Total Posts: 49   [ # 3 ]

You need to call view.scene.addChild() for the second one too.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X