GroundMesh.getHeightAtCoordinates() is corrupted by PhysicsImpostor.HeightmapImpostor

Hi all!

When porting my flightsim from 4.2.1 to 5 I ran into a couple of issues. Here is one:

Using a HeightmapImpostor on a GroundMesh seems to corrupt it’s ability to ask for a height at a certain (x,z) position using getHeightAtCoordinates().

  • just after creating GroundMesh and HeightmapImpostor, heights can be successfully asked for
  • after a rendering cycle, the values retrieved by getHeightAtCoordinates() are corrupted
  • asking for getHeightAtCoordinates(0,0) even crashes

I created a PG showing the effect, please look for the console:
PhysicsImpostor.HeightmapImpostor destroys getHeightAtCoordinates() | Babylon.js Playground (

Maybe related to a recent bug Fxi heightmap impostor with Cannon by CedricGuillemet · Pull Request #12818 · BabylonJS/Babylon.js ( ??

Additionally I found that asking for getHeightAtCoordinates(-99.9,-100) on a 200x200 heightmap crashes; regardless of HeightmapImpostor being used. That’s also demonstrated in the PG.

Hope for help,

. Jörg

I’ll do my best to fix it tomorrow.


Promised and delivered: