Havok Create HeightField From Ground Mesh

Yo @Cedric , @Marcello_Fabbiani , @RaananW , @ertugrulcetin

I see alot of example for havok and ground are using the PhysicsShapeMesh, We should really be using height fields shapes. Below is how i create physics shapes for the exported ground terrains from Unity. This example is also using my Left Handed GLTF extension so the loop to read the heights in to a Havok Physics shape is from the BOTTOM-UP and flipped from LEFT to RIGHT. So you want just regular loop… change

let index = j * width + i;

to define the index up top (let index = 0) and then simply use the following instead

index++;

As you can see, i create the height field directly from the Ground Mesh heights and not from some kind of heightmap image (Way better precision for better terrain accuracy)

The babylon scene with a few object and a exported Unity Terrain

3 Likes

Also ping @carolhmj
‘real’ heightfield shape is still planned.

1 Like