Greetings,
I am developing an environment which uses a non regular heightmap, one that is rectangular in a 2:1 ratio, as opposed to a usual square; blame the customer. Creating the mesh using BABYLON.MeshBuilder.CreateGroundFromHeightMap works fine. Problem arises when I apply a BABYLON.PhysicsImpostor.HeightmapImpostor. Some falling meshes collide as expected but others slip through the ground.
I have adapted a version of the “Heightmap demo physics engine” on the playground to illustrate the point:
The only change I have made is to line 19 swapping out 200 for 100 as the first option making the ground mesh rectangular, and meshes fall through the world. Change it back to 200, square ground mesh, and everything works fine.
Previous attempts have involved:
-
Using two heightmaps offset side by side but these produced a very ugly seam down the middle.
-
Using a square heightmap with alpha and using the alphaFilter option set to 1. This produced a usable mesh but the physics imposter failed to read the alpha areas resulting in meshes hanging in mid air.
Query: How do you apply a physics engine to a rectangular heightmap?
I’ve run out of ideas.
Thanks in advance.