Looking for some guidance on utilizing the dat.gui
package in my exploration of three.js. Struggling to figure out how to access the model outside of the loader.load
function.
let model
loader.load('new.glb', function(gltf){
model = gltf
scene.add(gltf.scene)
}, undefined, function (error) {
console.error(error)
})
const options = { wireframe: false}
gui.add(options, 'wireframe').onChange(function(e){
// encountering issue with 'cannot set properties of undefined' when trying to adjust 'wireframe'
model.material.wireframe = e
})
My research suggests this may be due to the asynchronous loading of the glb
file?
If anyone has insights or solutions, would greatly appreciate the help!