Hello,

I'm makeing my first steps in away3D.
I have such problem. I load .obj model of a house. I clone it to more
models and I want to add different materials on them.
I have no problem with changeing material, but I see that when i
change material of a cloned model all models change.
Is there a way of do it without loading different models for every
material I want to use? Couse mesh is always the same.

Here's what i tried:

function onLoadSuccess(event:Event):void
{
        var mesh:Mesh = houseLoader.handle as Mesh;

        for (var k in houseTar){
                var model:ObjectContainer3D = new 
ObjectContainer3D(mesh.clone());

                model.scale(2);
                model.children[0].useHandCursor = true;

                if (houseTar[k].mat == "sleep"){       //
                        for each (var i:Face in Mesh(model.children[0] as 
Mesh).faces) {
                                        i.material = new 
BitmapMaterial(Cast.bitmap(NewMaterial2));
                        }
                }

                scene.addChild(model);
        }
}

Thanks for anwser. (and sorry for my english)

Reply via email to