15

I'm looking for a lightweight, pure Java physics engine to do some simulations for robotic motion control.

My requirements:

  • Rigid body physics
  • Joint constraints and forces
  • Convex object collision detection
  • Lightweight, pure Java so it can be embedded in my application
  • Ability to run simulations quickly
  • Handles 50-100 objects comfortably
  • Open source

Rather than reinventing the wheel, can you recommend any existing libraries that would fit the bill?

p.s. I have Googled already - I'm just keen to get honest opinions from people who have already used or implemented such things!

mikera
  • 105,238
  • 25
  • 256
  • 415

2 Answers2

9

I have used JBullet and JBox2D. They both are good libraries. JBox2D is more actively being changed, but JBullet has slightly larger base.

Just for fun, I was trying to simulate an old physics problem recently, for which I posted the results here.

Amrinder Arora
  • 686
  • 7
  • 17
  • Thanks for the pointers! Were there any big differences between JBullet and JBox2D in terms of approach, capabilities or performance? – mikera Sep 19 '10 at 12:12
  • Also it looks like JBox2D is 2D only... may rule it out for some of my applications – mikera Sep 19 '10 at 12:17
  • Hmmm, I just found JBox2D to be easier to work with - but that was probably simply because the exact problem I was working with was more aligned to one of JBox2D examples. But yes, JBox2D is 2D only, and that may be a limiting factor. Btw, I found the performance of JBox2D *very* good - using with a 100 objects etc. A comparison of JBox2D with a different engine (Phys2D) can be found here: http://ciardhubh.de/node/15. That article does mention https://jmephysics.dev.java.net/ as a 3D engine candidate, but I have not worked with it. – Amrinder Arora Sep 21 '10 at 13:23
2

I would also use JBullet, though its been a couple of years since I last worked with it.

troutinator
  • 1,160
  • 1
  • 7
  • 22