Im trying to add texture to a glb model, but i keep getting said error. What have i done wrong?
** line is failing
Excerpt:
var loader = new THREE.GLTFLoader();
loader.load(
'models/animated_arrow.glb',
function (gltf) {
mesh = gltf.scene;
mesh.scale.set(1, 1, 1);
mesh.position.set(4.6, 0, 1);
mesh.rotation.set(1.575, 0, 0);
scene.add(mesh);
},
);
var textureLoader = new THREE.TextureLoader();
textureLoader.load('./img/AnimatedArrow.png', function ( map ) {
**mesh.material.map = map;**
mesh.material.map.encoding = THREE.sRGBEncoding;
mesh.material.map.flipY = false;
});