Terrain does not change anymore

Hi, i had this code that worked fine, now it doesn’t anymore, any clue?
The problem is that the old terrain is not deleted but is kept also when terrain respawn as the removeComponent doesn’t work

this.lM=app.root.findByName('Player').script.player.localMap;
            var img = app.assets.get(this.heightMap[this.lM]).resource.getSource();
            var model = this.createTerrainFromHeightMap(img, this.subdivisions);
            var collisionModel = this.createTerrainFromHeightMap(img, this.subdivisions / 2);
            
            this.entity.removeComponent('model');
            this.entity.model=null;
            this.entity.addComponent('model', {
                type: 'asset'
            });
            this.entity.removeComponent('rigidbody');
            this.entity.rigidbody=null;
            this.entity.addComponent('rigidbody', {
                type: 'static'
            });
            this.entity.rigidbody.friction=1;

            this.entity.removeComponent('collision');
            this.entity.collision=null;
            this.entity.model.model = model;
            this.entity.addComponent('collision', {
                type: 'mesh'
            });
            this.entity.collision.model = collisionModel;

Any error message? Anything in console? What do you mean by ‘doesn’t work anymore’?

No error messages. I put some beakpoint in code and it seems to work but when it run the old terrain isn’t deleted as it should, the rigidbody and collision body are removed but the terrain itself is always shown (before it vanished and haven’t changed the code) so i guess it’s something in the terrain from heighmap that doesn’t work as it should

Have you tried using an older version of the engine to see if it was due to changes? https://developer.playcanvas.com/en/user-manual/scripting/custom_engine/

Oh didn’t know about this feature, i can try that, where i can find the engine id that was running in july?

You can see the release version and dates here: https://github.com/playcanvas/engine/releases

Thanks a lot @yaustar i will post the results by tonight (i hope)

With the version 1.8.0 it worked fine with following no
I used
https://launch.playcanvas.com/396696?use_local_engine=https://code.playcanvas.com/playcanvas-1.8.0.js#
to test. In game when lunched use the m key to open the map click on the town of Foren or Rekdar and use fast travel button when the new terrain open the old one is there or it isn’t according to the engine version used

Errata corrige it happens from 1.8.1 to 1.8.2 and following

@yaustar i have to report this issue in feedback? or you already pointed the problem at developers?

I don’t know if it’s an issue with the engine or the terrain library. TBH, as it’s not a PlayCanvas feature, you would be better off talking to the developer of the terrain library.

I think it’s @will the developer of the terrain library