Making a billiard game, which physics library is better?

Im making a billiard game and looking for a fast, deterministic physics engine.

Im wondering if cannon.js prevents rigidbodies going through one another when they are moving at high speeds, that’s the problem I had with Bullet.js.

Also Im considering Oimo.js

Any ideas? thanks

Yohami

2 Likes

Billard game is usually tough to get right with generic physics engine. Most of the one I have seen are using their own “kind of” physics.

Ping @Cedric and @RaananW for more and for sure better advice

You should do your own for billiards honestly and I bet its has lots of raycasts in the end, which in turn give you the shot line UI that you see in most of them. Its kinda hard to do things like english on the ball with Oimo and Cannon.

Id say the same for golf games… now pinball or something maybe plinko Omio and Cannon all day?

2 Likes

IIRC bullet physics has a continuous collision detection system. Not sure it’s exposed by the IDL in ammojs.
But, usually, high velocity collision issues are fixed by adding more sub steps. It will be slower but you’ll get a better result.

https://doc.babylonjs.com/how_to/using_advanced_physics_features#substeps

Or make your own. Deterministic sphere collision detection is not that difficult.

2 Likes

Ammo.js works imho. It all depends on the level of accuracy you need, but, you can get something good with ammo. Here is an example I have built https://gcapsarena.com/ . Not exactly billiards, but, the physics are quite similar.

@Cedric is right as well, continuous detection helps with the high speed scenario. This is an issue that all physic engines will suffer though.

Ammo.js CCD is buggy which is why I was asking - BUT after decreasing the fixedTimeStep and increasing the maxSubSteps it’s working correctly, so I’ll stick with it

Thanks for the comments