From f2ea926f6bc19e02447a41962a1547878b4add89 Mon Sep 17 00:00:00 2001 From: Rose Hirigoyen <rosehirigoyen@gmail.com> Date: Wed, 9 Sep 2020 12:59:29 -0400 Subject: [PATCH] clear scene --- js/initScene.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/initScene.js b/js/initScene.js index e53e2f5..839512e 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 -- GitLab