The code:
function onAssetComplete(e:AssetEvent):void{
if (e.asset.assetType == AssetType.MESH){
if (e.asset.assetNamespace == "mesh1"){
mesh1 = e.asset as Mesh;
createMesh(mesh1);
view.scene.addChild(mesh1) //works fine
}
}
This first part works fine. Assuming I add mesh1 to the scene after running createMesh() there aren’t any problems. However, I have a timer that executes every 15 seconds roughly. Each execution it should add a new mesh based on mesh1…here’s the code for that:
private function onTimer(e:TimerEvent):void{
var newMesh:Mesh = new Mesh(mesh1.geometry,mesh1.material);
view.scene.addChild(newMesh);
meshArray.push(newMesh);
}
In this case everything executes as it should; it even adds newMesh to the meshArray (which I know because I have a separate function that loops through meshArray), however newMesh is never actually added to the scene; or if it is it’s not visible. The strangest part is I have another mesh that’s loaded and created the exact same way, and when I create another mesh from it it works without issue. Any ideas what the problem could be?