Merge, AWD2 and Maya duplicate instances

Software: Away3D 4.x

John Brookes, Moderator
Posted: 29 July 2011 06:54 PM   Total Posts: 732

Lots of objects in a scene that are Maya duplicate instances. Works great with awd2 and keeping file size down.
Using bullet physics so I have the static objects grouped under a do3d. Just tried to Merge this do3d and all the meshes are offset. Im guessing it to do with using instances. Tried centering each mesh geometry through AssetEvent.ASSET_COMPLETE, that made no diffence.

So erm, what to do? And I am right in thinking that merging the instance objects that share geometry should be better for frame rate. Or even it should work?

 

   

Somokon, Member
Posted: 29 July 2011 07:04 PM   Total Posts: 75   [ # 1 ]

The position of each mesh needs to be relative to the mesh you are merging into.

For example, if you are merging object2 into object1, and the position of object2 is set to (0, 100, 0), merging will put object2 100 units above object1, wherever object1 is in the scene.  Using absolute positioning for all objects will result in the situation in your pictures.

Hope that made sense smile

 

   

John Brookes, Moderator
Posted: 29 July 2011 07:19 PM   Total Posts: 732   [ # 2 ]

Either I don’t get what you mean or you dont get what I mean smile)

Only thing that I can think that makes a difference is say create an object in Maya move it into position, freze all transforms then duplicate.
Unfortuantely cant freeze the tranform once its duplicated, or cant find a way.

Ill have to test different ways.
Just sulking at the moment as already done that model without instances, now its looking like I have to redo all for a third time. :(

 

   

John Brookes, Moderator
Posted: 29 July 2011 08:03 PM   Total Posts: 732   [ # 3 ]

Done a little test.
Each cube duplicated from the left one with translate X of cube width (so they should be next to each other)
Issue with instances and merge, freezing transforms doesn’t solve it. :(

 

   

John Brookes, Moderator
Posted: 29 July 2011 08:05 PM   Total Posts: 732   [ # 4 ]

Arrg silly preview, 3 pic limit

 

   

Somokon, Member
Posted: 29 July 2011 08:17 PM   Total Posts: 75   [ # 5 ]
JohnBrookes - 29 July 2011 08:03 PM

Done a little test.
Each cube duplicated from the left one with translate X of cube width (so they should be next to each other)
Issue with instances and merge, freezing transforms doesn’t solve it. :(

Try translating only 1/2 of the cube width

 

   

John Brookes, Moderator
Posted: 29 July 2011 08:35 PM   Total Posts: 732   [ # 6 ]

Thats really not an option.

 

   

John Brookes, Moderator
Posted: 30 July 2011 04:33 PM   Total Posts: 732   [ # 7 ]

Not Maya or awd2.
Just something to do with Merge and shared geometry.
These 6 cubes should be in the same X pos
The merged ones become offset.
eg

//Merge 3 cubes with shared geometry
var mainCube:Cube = new Cube(new ColorMaterial(0x6e3f2b));

var 
c2:Mesh = new Mesh(mainCube.materialmainCube.geometry)//just to be different ;)
c2.200;

var 
c3:Mesh mainCube.clone() as Mesh;
c3.= -200;

mainCube.geometry.scale(2);

var 
vct:Vector.<Mesh> = new Vector.<Mesh>;
vct.push(c2c3);

var 
merge:Merge = new Merge(true);
scene.addChild(merge.applyToMeshes(mainCubevct));



//not merged
var mainCubeNM:Cube = new Cube(new ColorMaterial(0x6e3f2b));
scene.addChild(mainCubeNM);
mainCubeNM.300;

var 
c2NM:Mesh = new Mesh(mainCubeNM.materialmainCubeNM.geometry)
scene.addChild(c2NM);
c2NM.200;
c2NM.300;

var 
c3NM:Mesh mainCubeNM.clone() as Mesh;
c3NM.= -200;
c3NM.300;
scene.addChild(c3NM);

mainCubeNM.geometry.scale(2); 

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X