3D Physics / Collision Engine

I’m looking for a decent 3rd party library for collisions and physics. It looks like the 2 major options are JBullet and ode4j. I was wondering if anyone had experience with these libraries / suggestions. JBullet looks like it hasn’t release since 2010 but ode4j is still in active development.

Hi

I advise you to use dyn4j. I thought it was just yet another physics engine but actually, it is actively developed and maintained, it uses a lot of JUnit tests, it is really good and it has a lower memory footprint than JInngine and JBullet. Best regards.

dyn4j looks interesting, thanks for the post. But its a 2D engine and I need a 3D one

Also I’m wondering if anyone has actually released a game with a JBullet as a part of it. I can’t much on the googles.

There has been some stuff done with bullet as part of JME3. I don’t know the details but I know it’s integrated into the engine and I think they are working on a new version of it.

ODE (the engine ode4j ports) isn’t exactly updated either. Last release is from 2012, but according to changelog it provides just few bugfixes and the release before was from 2009. More importantly ODE is awful engine, I was very glad to leave it in 2007 when I discovered Bullet. With (J)Bullet you can use either high-level API, or when in need you can use any of the implementation classes yourself.

When doing real projects using real-time physics engine it’s very often about doing many tricks, and access to implementation classes is very helpful. Also it contains continuous collision detection (EDIT: it seems ode4j got it too), not much well integrated with regular physics world, but you can invoke it manually for various needs. In my game I’ve used it for FPS player movement to provide sliding over walls and for detection of geometry so I can limit certain positions of player.

Also one thing to remember that even when physics engines provide collision detection it’s not suitable for some tasks, like raytracing. It’s way more efficient to write your own code for that, eg. using KD tree.

Yes JBullet could probably get some minor update, but the thing is that it works as is.

I’ve created JBullet to power my game: Resistance Force, but it will take some time to “release” that :wink: Don’t know of any “bigger” game (look at JME3 based games, some of them probably use JBullet), though people use it also for various non-gaming stuff.

not 100% but I think I watched a bit of a live stream of Notch’s 0x10c stream, and if I’m remembering right, he put in JBullet (not 100% sure)

Thanks Jezek2. And I am already using an OctTree but I was implementing the SAT test for OBB and was having too many issues. I can detect the collision, but figuring out the MTV was proving to be a giant pain the ass. I hoping your library can ease the pain so I can actually start working on the game and I’ll need physics eventually anyways. Can I reuse my OctTree and tell the physics engine to only perform simulation on X group of objects?

You can write custom Broadphase (needs a bit of innerworkings to know), but octree is not good structure for physics (and I suspect even in general case). JBullet has AxisSweep or DbvtBroadphase that are optimized on checking what objects are touching, the most useful property for physics engine (along with fast add/remove and position update).

In your case if you’re already using it for different things I would just register the dynamic objects to JBullet, thus having them in both structures. In games that’s pretty standard thing, to have different “databases” of things instead one, because different structures have different advantages, or it needs to be for different purposes (eg. spatial vs rendering order).

No it works for 3D too despite its claim in the “about” page.