diff --git a/js/initScene.js b/js/initScene.js index e53e2f552ab50f2e8b25d6cf712c9673d88aaab0..839512e233caad115e63ca63828bd763adce746d 100644 --- a/js/initScene.js +++ b/js/initScene.js @@ -274,6 +274,7 @@ var addUI = function () { isSimulationRunning = false let simBtn = document.getElementById("simBtn") simBtn.disabled = true + cleanSimulation() var filestoLoad; // Handling files from input files if (event && event.target && event.target.files) { @@ -363,6 +364,14 @@ var setupSimulation = function (data) { } +var cleanSimulation = function() { + for(let i = 0; i < vehicules.length; i++){ + vehicules[i].vehicule.dispose() + vehicules[i].vehicule = null + } + vehicules = [] +} + var runSimulation = function () { if (isSimulationRunning) { success = false