hello katopz,
thx for the fast answer... to change the hole texture from one object
is ok, but i want to change the texture from several objects
independant from others in the collada data!?
for example - in my collada test data is a cube and a plane... i want
to retexture the cube with a hair texture e.g. and the plane with
another texture after loading the collada data with parse or load in
my scene!? and in the scene i want to change the texture from both
objects again...
private function init3D():void
{
scene = new Scene3D();
camera = new Camera3D({zoom:10, focus:100, x:-100,
y:-200,
z:-500});
view = new View3D({scene:scene, camera:camera});
view.x = 540 / 2;
view.y = 600 / 2;
addChild(view);
setCameraPosition();
var texture:PhongBitmapMaterial = new
PhongBitmapMaterial
( Cast.bitmap( FlashmanTexture ));
var texture2:PhongBitmapMaterial = new
PhongBitmapMaterial
( Cast.bitmap( FlashmanTexture2 ));
var loader:Loader3D =
Collada.load("collada/testtex.dae", {scaling:
0.01, material:texture2});
loader.addOnSuccess(onLoaderSuccess);
view.scene.addChild(loader);
}
private function onLoaderSuccess(event:Loader3DEvent):void
{
trace("onLoaderSuccess start");
var target:ObjectContainer3D = new ObjectContainer3D;
// camera auto lookAt target in simple view
target = ObjectContainer3D(event.loader.handle);
target.scale(100);
// try change "lambert1" material
var targetMaterial:MaterialData =
target.materialLibrary.getMaterial("ID3");
targetMaterial.material = new BitmapFileMaterial("assets/
texture.jpg");
var targetMaterial2:MaterialData =
target.materialLibrary.getMaterial("ID8");
targetMaterial2.material = new BitmapFileMaterial("assets/
texture2.jpg");
// fun!
createScene();
trace("onLoaderSuccess ende");
}
#### debug
! ------------- Begin Parse Collada -------------
! ------------- Begin Parse Scene -------------
+ Parse Node : ID14 : ID14
+ Parse Node : ID23 : ID23
! ------------- End Parse Scene -------------
! ------------- No animations to parse -------------
+ Parse Geometry : ID15
+ Parse MeshMaterialData
+ Parse Geometry : ID24
+ Parse MeshMaterialData
+ Build Material : ID8
+ Material Type : textureMaterial
+ Build Material : ID3
+ Material Type : textureMaterial
+ Build Mesh : ID14
+ Build Mesh : ID23
##### debug
its curious - when i change the texture from the material "id8" is
happens nothing, he take the texture from the loading line... when i
change the material "id3", both objects get the texture...
ok, is it a mistake in my code or!?
thx
martin
On Aug 29, 8:07 am, katopz <[email protected]> wrote:
> Hey martin
> try this for Collada
>
> http://away3d.googlecode.com/svn/trunk/fp9/Examples/Collada/src/ExCol...
>
> hth
>
> 2009/8/29 martin <[email protected]>
>
>
>
>
>
> > hello,
> > you mean this part:
> > "
> > mesh1= iguanaModel.getChildByName("Cube") as Mesh;
> > modify the like this:
> > mesh1.rotationX=160;
> > mesh1.material=precitionMat;
> > and after that put them back:
> > iguanaModel.addChild(mesh1 as Object3D);
> > scene.addChild(iguanaModel);
> > "
> > from the posting
> >http://groups.google.com/group/away3d-dev/browse_thread/thread/cab29e...
> > it doesn't work? everything i have the same texture from the init
> > parse material from collada.parse etc...
> > do u have a solution?
> > i found no way yet ;-(
> > greets
> > martin
>
> > On Aug 26, 2:33 pm, desgraci <[email protected]> wrote:
> > > i think that this might work, check the 2 last post, is very similar
> > > to what ure looking.
>
> > >http://groups.google.com/group/away3d-dev/browse_thread/thread/cab29e...
>
> > > let me know, it works at least for me...
>
> --
> katopzhttp://www.sleepydesign.com