I am very new to Away3D and I am trying to load an embedded DAE model in Away3D for the first time. I am trying to load only the model and then apply the textures separately, but I’ve hit a snag because I am unable to extract the mesh from the loader:
I am using the following code to load the model:
//load model
var byteArray:ByteArray = new ModelClass ( );
loader3D = new Loader3D();
loader3D.loadData(new XML(byteArray), new AssetLoaderContext(false), null, new DAEParser());
loader3D.addEventListener(LoaderEvent.RESOURCE_COMPLETE, onResourceComplete);
The AssetLoaderContext() is set to false so that I can add the textures separately later.
The onResourceComplete() function is now being called by the listener:
private function onResourceComplete(event:Event):void
{
var obj:Object3D = loader3D;
myMesh = obj as Mesh;
var box:ObjectContainer3D = new ObjectContainer3D();
box.addChild(myMesh);
}
I am not sure how to get the mesh from the loader. I am sure I must be doing it wrong. The last line box.addChild(myMesh) returns an error because myMesh = null.
How do I get the mesh from the loader?
Using loader3D.getChild(0), I find that it returns null, so loader3D has no children
Is the model just not loading?
I know there are issues with the DAEParser in Away3D and I am using a fairly large Blender model exported as a DAE. Incidentally the model loads fine in Papervision3D!
Is there something obvious I have overlooked?