I am trying to load an object and make some clones of it on start, however I cant seem to find a way to identify if a mesh has finished loading. Is there such a parameter? Or do I need to implement my own system for this? I don’t want to be constrained to the on complete callback, I should specify that. Otherwise it was easy
loadFBX = (name: string, material: Material, raycastable: boolean, receiveshadow: boolean) => {
this.loader.load('../../assets/meshes/' + name + '.fbx', (object: THREE.Group) => {
object.traverse((child: THREE.Mesh) => {
if (child.isMesh) {
child.material = material;
child.castShadow = true;
if (receiveshadow) {
child.receiveShadow = true;
}
material.isVisible = true;
}
});
if (raycastable) {
this.rayCastable.push(object);
}
object.name = name;
this.scene.add(object);
});
}