I am trying to get a promise from the loadAsync function so that I can use the async, await technique to instansiate an object in my scene. But the problem is that the promise is always pending and that the promiseResult property undefined is. What am I doing wrong? I think I have to specify something else as the return value but after reading the documentation I still don’t know what I am doing wrong. See code below:
async function loadCar() {
var gltfLoader = new THREE.GLTFLoader();
var loader = new THREE.Loader(gltfLoader);
var promise = loader.loadAsync("car/scene.gltf");
console.log(promise);
var result = await promise;
console.log(result);
}