Hi Fabrice, can you explain this comment a bit more?

> access the materiaLiibrary or nullify thematerialat face level and apply.
> materialLibrary.getMaterial("name");

I also need to change the material on a Mesh I read via Obj:
    material = new BitmapFileMaterial("test.jpg");
    var objParser:Obj = new Obj({material:material});
    etc.
But I need to assign a new texture at run time (can't just change
the .obj file). Even with your comment above I can't figure it out
(sorry!)

So, how would I null out the material at face level? I assume if face
material is nulled, if I assign mesh.material it will work...

And what do you mean about doing it through the materialLibrary? The
material library has a single MaterialData in it that just shows
ambientColor and diffuseColor as 0. I tried setting that key to a new
material but it had no effect. I'm think I'm not understanding
something about how materials work.

Thanks!

On Feb 4, 12:19 pm, Fabrice3D <[email protected]> wrote:
> access the materiaLiibrary or nullify thematerialat face level and apply.
> materialLibrary.getMaterial("name");
>
> but since its anObjfile, you also can alter by hand theobjfile, remove the 
> "mtllib mtlname.mtl" line at top file and
> remove all the "usemtl matname" most of the time located between VT and F 
> tags. in this case your code will work.
>
> Fabrice
>
> On Feb 4, 2010, at 9:02 PM, Flo711 wrote:
>
> > Hello,
>
> > I have loaded a mesh by doing :
>
> > object3DLoader =Obj.load("model.obj", {material:bitmapMaterial,
> > name:"crist", scaling:30, x:0, y:0, z:0, loadersize:200});
>
> > object3DLoader.addOnSuccess(onLoaderSuccess);
>
> >            private function onLoaderSuccess(e:Loader3DEvent):void {
>
> >                    if(e.loader.handle is Mesh){
>
> >                            mesh = e.loader.handle as Mesh;
> >                            mesh.material= new ColorMaterial();
>
> >                    } else {
>
> >                    }
> >            }
>
> > But I can't figure how o acces thematerialto change it within the
> > function onLoaderSuccess.
> > when I trace(mesh.material) I get null before doing : mesh.material=
> > new ColorMaterial();

Reply via email to