Integrating a modern and maintained physics engine to Babylon.js

Hi everyone!

I decided to add a topic here on this manner, since I’m a bit worried on the physics engine integrations / plugins of today’s Babylon.js. This is mostly to add conversation on the topic in one place. Hopefully it hasn’t been done in some other place :sweat_smile:.

There are two concerns that I have on the current state physics engine state:

  1. Current physics engines (Ammo.js, Cannon.js, Oimo.js) are not maintained. And that kind of means that all the bugs will be there forevermore… For example, I think it is still a problem that physics objects can’t enter sleep state, in at least Ammo.js, which unfortunately happens to be the most performant of the current engines. And Ammo.js creator doesn’t work on the project anymore.
  2. The npm packages are all over the place, so actually adding an physics engine to a modern Babylon.js project with es modules and TypeScript is a hassle. For example, ammo.js - npm is not what you would want, but this ammojs-typed - npm. However, this might differ from the original package…

Well, how about some solutions? Here are some alternatives that I came up with:

  1. Maintain an own “Ammo.js” port of the Bullet engine, with TypeScript and support for es modules.
  2. Use a new physics engine that is well maintained, for example:
  3. Maintain own Physx wasm/js port. Most work?

I would very much like to hear what the future plan for the physics integrations would be… Are there more solutions that what I’ve presented? Is there already an official plan in motion? Anyway, I think discussion on this matter is welcome :slight_smile::pray: Cheers!


@RaananW @Cedric

1 Like

I agree physics engines get less maintained and we need to do something.
We also see build issues between versions of ammo : AmmoJs SoftbodyImpostor - "b._free is not a function" error - #13 by ruzrobert
Adding a new physics engine while still supporting existing ones might not be a good idea because of lack of time.
This is a discussion we will have for babylon.js 6.
Physx is, IMHO, the best available on native and the wasm version needs some tests to see how stable it is. Do we need to maintain a build on our side?

The Babylon team will gather in June. It will be the perfect moment to discuss what we want to do. @PirateJC @Deltakosh


PhysX would be a great addition IMHO :slight_smile:

1 Like

I think too but we need to check the license for us and our partners. For example, partners can do paid product with babylon.js. Will they be able with PhysX as they can with Ammo or Cannon?