Importing “.obj” as container and modifying individual meshes in it

Software: Away3D 4.x

erroneous seth, Newbie
Posted: 20 October 2011 04:58 PM   Total Posts: 28

Hello to everyone,

I create two cubes in “Blender” and export them in a single file (say, “scene.obj”).

Now, following the Car Triangle Mesh example (note the “onCarResourceComplete” method), I do the following:

private function _onResourceComplete(event LoaderEvent) void {
   trace
("load complete");
   
_loader.removeEventListener(LoaderEvent.RESOURCE_COMPLETE_onResourceComplete);
   
_loader.removeEventListener(LoaderEvent.LOAD_ERROR_onLoadError);
   
   var 
container ObjectContainer3D ObjectContainer3D(event.target);
   
_view.scene.addChild(container);;
   
   var 
cube Mesh;
   for (var 
uint 0container.numChildreni++) {
    cube 
Mesh(container.getChildAt(i));
   
}
  } 

However, the cubes are not displayed on the screen.

Could someone, please, explain to me why?

What I am trying to do, eventually, is assign different “shapes” of the Away3DPhysics engine to each “cube”.


Thanks a lot.

P.S.: I attach the “.blend” and “.obj” files I used.

 

File Attachments
cubes.rar  (File Size: 48KB - Downloads: 0)
   

erroneous seth, Newbie
Posted: 20 October 2011 05:15 PM   Total Posts: 28   [ # 1 ]

Solved.

I had to “scale” each mesh.

private function _onResourceComplete(event LoaderEvent) : void {
   trace
("load complete");
   
_loader.removeEventListener(LoaderEvent.RESOURCE_COMPLETE_onResourceComplete);
   
_loader.removeEventListener(LoaderEvent.LOAD_ERROR_onLoadError);
   
   var 
container ObjectContainer3D ObjectContainer3D(event.target);
   
_view.scene.addChild(container);
   
   var 
cube Mesh;
   for (var 
uint 0container.numChildreni++) {
      cube 
Mesh(container.getChildAt(i));
      
cube.geometry.scale(50); // NEW LINE
   
}
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X