Hi All,
I'm Aleks, Animation Artist and Developer.
---------------------------------------------------------
First off, I want to say I realize there are many posts on this issue.
I am sure I have read about 95% of them. This is my second Away3d
project, and this time it was much more of a challenge because of the
new 3.5.0 methods and their differences to much of the resource code
and examples out there.
I do feel like what I am trying to do here should be the simplest of
all things while working with a 3d-engine, but unfortunately this has
become a real obstacle with my project with days spent researching and
trouble-shooting this. That being said, I also am thankful to the
makers of away3d and the time they give to the community and recognize
its likely that they are a too busy to update all the documentation
and examples on this.
However, I am definitely not alone in this particular issue, and when
someone has the time to clear this issue up a little more succinctly,
I think it would be time well-spent.
My Issue:
---------------------------------------------------------
I understand that the suggested method for changing materials at run-
time is to use the AWD file format.
I have done that, I cast it as a mesh, and then assign the material.
Tracing shows that the material is being assigned.
However, the mesh still only shows its default wireframe material.
I have attempted to both search the e.loader.handle material data with
a for statement, as well as replacing the material at face level.
Nothing happens! What am I doing wrong here? I have tried color
materials, bitmaps, and ultimately, I want to use a MovieMaterial.
Code:
---------------------------------------------------------
var loaderAWD:Loader3D = new Loader3D();
loaderAWD.addEventListener(Loader3DEvent.LOAD_SUCCESS, onSuccess);
//loaderAWD.addEventListener(Loader3DEvent.LOAD_ERROR, onLError);
var awd:AWData = new AWData();
loaderAWD.loadGeometry("assets/belizeMesh.awd", awd);
}
public function onSuccess(e:Loader3DEvent):void {
var myObject3D:Object3D = e.loader.handle;
var myMesh:Mesh = myObject3D as Mesh;
trace ( myMesh.material);
for each (var materialData:MaterialData in myObject3D.materialLibrary)
{
materialData.material = belizeMainlandMat;
Thanks Again Guys!
- Aleks
}
for each (var i:Face in myMesh.faces) {
i.material= belizeMainlandMat;
}
myMesh.material = belizeMainlandMat;
this.view.scene.addChild(myMesh);
trace (myMesh.material);
Thanks.