Recommended Physics Engine?

What Physics engine would you guys recommend? Rn I have been using Physijs but theres a lack of documentation (especially on the impulse forces). Is it worth trying pure ammo.js?

1 Like

Well, most official physics examples are based on ammo.js:

https://threejs.org/examples/?q=ammo

This code might make it easier to get started with three.js and ammo.js.

1 Like

For your reference

ammo . js , a port of the Bullet physics engine from C++ to JavaScript
Ammo.js still lack documentation .
To know more about it you can check on the bullet documentation : Bullet Documentation

1 Like

I have made a cool ammo.js based library. Check it out at
@enable3d/ammo-physics

5 Likes

I’ve used Physijs and Cannonjs,
I found cannonjs better performance.
They are both quite easy to use.
However, physics engines are not magic, you will need to manage your expectations. The more calculations made by the physics engines each render loop will affect performance.
Here is 1 example of Cannonjs.

3 Likes

Something I don’t see too often that I’d like to suggest are the emscripten bindings for PhysX (https://www.npmjs.com/package/physx-js). I’ve been playing with that for the past 2 months and quite like it. While it is fully documented on the PhysX website, the documentation isn’t for js… Also there are some missing pieces in the bindings, but you can add your own bindings to fill in those missing pieces if you’re handy with C++

2 Likes

Rapier3D looks good too:

If you use the Parcel bundler like me you must use rapier3d-compat This is my example in rapier2d-compat in TypeScript: rapier2d-compat-example - CodeSandbox that just prints a version and a vector:

import rapier from "@dimforge/rapier2d-compat";

rapier.init().then(() => {
  console.log(rapier.version());

  const vec = new rapier.Vector2(1, 2);
  console.log(vec);
});
1 Like

OimoPhysics is originally written in the Haxe language, and then automatically compiled into JS. It can be used with TypeScript. By the way, OimoPhysics is the most productive engine. My laptop is very quiet with it, and with Ammo.js, Cannon-ES and Rapier3D, the laptop starts to make above average noise. Small example on OimoPhysics and Three.js: https://codepen.io/yamazaki3104/pen/jjZyLX

OimoPhysics v1.2.3: https://cdn.jsdelivr.net/gh/saharan/OimoPhysics@1.2.3/bin/js/OimoPhysics.js

The latest version of OimoPysics (v1.2.3) was released on January 29, 2022, but it was not uploaded to NPM. v1.2.2 was published 3 years ago. I created the issue: Please, upload a new version (v1.2.3) to NPM · Issue #53 · saharan/OimoPhysics · GitHub

Try the Cannon-Es its fast and easy to use, u can check Cannon-Es physics performance with this project

@Umbawa_Sarosong your project makes my laptop very noisy. I think it’s 10-15 FPS.

Asus K53SV; 8 GB RAM, i3 2.2 GHertz (2 cores); Intel HD Graphics 3000; Nvidia GeForce GT 540M (1 GB); Windows 10

1 Like

@8Observer8 thatks for the feed back, i will see what i can do to make my project lite and efficient for all devices,