Ground collision using MeshBuilder.CreateGroundFromHeightMap() and Havok

Surely this is a newbie question, but I spend the day trying to figure out by myself with no results.

I am trying to create detect collision of a sphere in the ground created by CreateGroundFromHeightMap() using Havok.

The examples that I found are ambiguous and I tested each one of them. Some use Impostors, other uses PhysicsAggregate()… I am not sure about which one I should use to the PhysicsV2.

I want to use the HeightMap as a general landscape and put objects over it, but they still pass thru the floor.

May someone point some clear and simple example how it should be doe the right way? Most I found uses meshes but I want something more “organic” that a pile of tiles.

I suggest add this example to the main tutorial also.


Hello and welcome abroad!

Thanks for the feedback on the documentation, it’s very important to us to be able to improve it. :slight_smile: Impostors are from the V1 API, while aggregates are V2. You can see an example here: Simple heightmap example | Babylon.js Playground ( One very important thing to note on this example is that you need to create the physics entities inside the onReady callback, because the ground mesh creation is asynchronous.

You are not required to use aggregates when using the V2 API through, as they’re just a convenience function for creating bodies and shapes, which are the base of the V2 API.

1 Like

Thanks, @carolhmj . Works sweetly!

I got very impressed with your great work guys for two reasons: 1. BabylonsJS is impressive, obviously; 2. The community is wonderful.
I’ve been in IT for 25+ years and been a long time since I saw a so health community mindset. I am honor to participate now.

If I may make a suggestion about the documentation, it is to create a tutorial from begin to end about the physics.For some reasons: 1. It is a complicated and powerful topic where the change from V1 to V2 is creating a lot of confusion. 2. This is becoming even more relevant with the whole metaverse thing. (Yeah, we as a market gonna go back to this topic again in the next years… ). 3. The change to Havok is that relevant.

1 Like

Thank you so much for your kind words! We value a lot keeping this community healthy and welcoming so it’s good to hear we’re on the right track :slight_smile: A comprehensive getting started tutorial for physics is definitely a good idea, perhaps something in the mold of our other getting started tutorial: Introduction to Babylon.js Features | Babylon.js Documentation ( (it could even be a new chapter to it)
I created an issue in our docs repo so we don’t forget: Physics “Getting Started” tutorial · Issue #1050 · BabylonJS/Documentation (

I appreciate the attention to me and the dedication on doing a great job.
I hope to contribute with the community ASAP.

1 Like