I'm fairly new to Three.js and I have a question. Is it possible to load a 3D model into Three.js and maintain that loaded model as a value in my object? The issue is, when I try to do this, I encounter a problem where I can't access this.instance later in other functions within my object.
constructor(name,chords,scene){
this.instance;
var mtlLoader = new THREE.MTLLoader();
mtlLoader.setTexturePath(`/assets/${name}/`);
mtlLoader.setPath(`/assets/${name}/`);
mtlLoader.load(`${name}.mtl`, (materials) => {
materials.preload();
var objLoader = new THREE.OBJLoader();
objLoader.setMaterials(materials);
objLoader.setPath(`/assets/${name}/`);
objLoader.load(`${name}.obj`, (object) => {
this.instance=object;
scene.add(this.instance);
});
});