diff --git a/tabs/magnetometer.js b/tabs/magnetometer.js index d32ffbe16..3441c86a7 100644 --- a/tabs/magnetometer.js +++ b/tabs/magnetometer.js @@ -690,9 +690,9 @@ TABS.magnetometer.initialize3D = function () { const loader = new THREE.GLTFLoader(manager); const magModelNames = ['xyz', 'ak8963c', 'ak8963n', 'ak8975', 'ak8975c', 'bn_880', 'diatone_mamba_m10_pro', 'flywoo_goku_m10_pro_v3', 'foxeer_m10q_120', 'foxeer_m10q_180', 'foxeer_m10q_250', - 'geprc_gep_m10_dq', 'hglrc_m100', 'qmc5883', 'ist8308', 'ist8310', 'lis3mdl', - 'mag3110', 'matek_m9n', 'matek_m10q', 'mlx90393', 'mp9250', 'qmc5883', 'flywoo_goku_m10_pro_v3', 'ws_m181']; - magModels = []; + 'geprc_gep_m10_dq', 'hglrc_m100', 'qmc5883', 'ist8308', 'ist8310', 'lis3mdl', + 'mag3110', 'matek_m9n', 'matek_m10q', 'mlx90393', 'mp9250', 'qmc5883', 'flywoo_goku_m10_pro_v3', 'ws_m181']; + magModels = []; //Load the UAV model loader.load('./resources/models/' + model_file + '.gltf', (obj) => { @@ -703,23 +703,22 @@ TABS.magnetometer.initialize3D = function () { const gpsOffset = getDistanceByModelName(model_file); - magModelNames.forEach( (name, i) => - { - //Load the GPS model - loader.load('./resources/models/' + name + '.gltf', (obj) => { - const gps = obj.scene; - const scaleFactor = i==0 ? 0.03 : 0.04; - gps.scale.set(scaleFactor, scaleFactor, scaleFactor); - gps.position.set(gpsOffset[0], gpsOffset[1] + 0.5, gpsOffset[2]); - gps.traverse(child => { - if (child.material) child.material.metalness = 0; - }); - gps.rotation.y = 3 * Math.PI / 2; - model.add(gps); - magModels[i]=gps; - this.resize3D(); - }); - }); + magModelNames.forEach( (name, i) => + { + loader.load('./resources/models/' + name + '.gltf', (obj) => { + const gps = obj.scene; + const scaleFactor = i==0 ? 0.03 : 0.04; + gps.scale.set(scaleFactor, scaleFactor, scaleFactor); + gps.position.set(gpsOffset[0], gpsOffset[1] + 0.5, gpsOffset[2]); + gps.traverse(child => { + if (child.material) child.material.metalness = 0; + }); + gps.rotation.y = 3 * Math.PI / 2; + model.add(gps); + magModels[i]=gps; + this.resize3D(); + }); + }); //Load the FC model loader.load('./resources/models/fc.gltf', (obj) => {