.dispose() works / .translate() crash tab of browser

if (linebuilder == 1){
    if (gridMovePossible == 1){
       gridMovePossible = 0;
      for (var i = 0; i < scene.meshes.length; i++) {
        var mymesh = scene.getMeshByName("linename");
        // mymesh.dispose();
        // mymesh.translate(BABYLON.Axis.Y, 1, BABYLON.Space.SPACE);
        i--;
         }
       gridMovePossible = 1;
      }
    }
  else{
      console.log("grid not exist");
  }
  }

Space (default LOCAL) can be either Space.LOCAL, either Space.WORLD
See API - AbstractMesh | Babylon.js Documentation

@labris two methods meka et browser crash

PS : if you have multiple codepen tabs, close all tabs of codepen because all tabs must close to remake a test.

wtf crash ?!

You should remove that and use the method from the latest PG I shared with you in the other post, using the ‘while’ method to dispose of a large number of meshes. This was a hack and it can possibly cause issues.

And then, I’m not sure what you want to do with this function. And then, ‘transLate’ does not exist and the syntax and parameters are all wrong there. Check this part of the doc

if (linebuilder == 1){
    if (gridMovePossible == 1){

You can also add conditions in a single instruction for the ‘if’ condition, although it’s not wrong to do it with an imbrication like you did. I.E:

if (linebuilder == 1 && gridMovePossible == 1){
//do something if both conditions are met
}

Hope this helps,

1 Like

I would highly recommend reading up on the Introduction to Babylon.js Features | Babylon.js Documentation (babylonjs.com) series to get used to the Babylon.js methods and philosophy :slight_smile:

1 Like

Solved, line its bad haha. i destroy and remake for move this :DDD Solved :slight_smile: