Im trying to make my Project a little better by fixing all issues with sonar and I am stuck on the error displayed in the title. The function is loading a blender model with the help of three.js and sonar tells me to not use the function more than once but I need to load multiple models with this function.
function raining(temp, timezone) {
let rain = [];
function loadGLTF() {
let Loader = new GLTFLoader();
Loader.load("./model/rain.gltf", (gltf) => {
Mesh = gltf.scene;
Mesh.scale.set(0.2, 0.2, 0.2);
scene.add(Mesh);
camera.target = Mesh;
Mesh.position.x = 0;
Mesh.position.y = -0.4;
Mesh.position.z = 0;
});
}
I can put the loadGLTF function out of the raining one but how can I use the function again to load my second model ./model/snow.gltf