Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
assetLoader
private loadAssets(){
console.log("loading assets");
this._assetManager=new AssetsManager(this._Scene);
let meshTask=this._assetManager.addMeshTask("gemTask","Skull","Assets/","Skull.obj");
meshTask.onSuccess=(task:MeshAssetTask)=>{
console.log("load success");
console.log(task);
task.loadedMeshes[0].position=Vector3.Zero();
}
meshTask.onError=(task,message,exception)=>{
console.log(message,exception);
}
this._assetManager.onFinish=(tasks)=>{
console.log("loading finished");
this.runEngine();
}
this._assetManager.onProgress = (remainingCount, totalCount, lastFinishedTask)=>{
this._Engine.loadingUIText = 'We are loading the scene. ' + remainingCount + ' out of ' + totalCount + ' items still need to be loaded.';
};
this._assetManager.load();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment