Physics V2 replacement for AmmoJS' Mesh Impostor

Good day! I am new to BJS, and haven’t ever used AmmoJS, but I found this PG:

I can see the ball falls and rolls down the hill, and I would like to replicate the same using Havok, but I haven’t been able so far. I read about PhysicsAggregate and my assumption is using BABYLON.PhysicsShapeType.MESH the way to go, but I get the following:

No valid mesh was provided for mesh or convex hull shape parameter.

I have used a CreateGroundFromHeightMap, and also a GLB file mesh, and none of them were working for me.

I would really appreciate any help, guidance, documentation on this subject as I am kind of lost.

Thank you!

Hello and welcome to the Babylon community! :smile:

There’s a problem with the type checking in the aggregate creation, sorry about this :pensive: I’m working on a fix right now

1 Like

Here’s the PR to fix the type checking for the Ground Mesh! [Physics] Fix type checking for mesh parameter in aggregate by carolhmj · Pull Request #13919 · BabylonJS/Babylon.js (github.com)

About the GLB file mesh, I think you might be using root node of the model for the aggregate, which won’t work because that node doesn’t have vertices. You can see how I did it for a GLB here: Babylon.js Playground (babylonjs.com), notice that I’m using the second element of the imported meshes array, because I know this one has vertices. I also null the parent because currently the physics don’t handle nodes with parents (we’re working on it right now).

1 Like