I’m trying to integrate Jitter Physics in Unity. There is no specific reason, just the curiosity. I spent a couple of hours yesterday and got box and sphere colliders working. Bricks could fall, balls could roll, the objects could collide with each other. It was a surprise actually, I wasn’t expecting any results that soon.
Jitter has little to no documentation, so it’s hard to see its pros and cons in comparison with PhysX. The differences I know at the moment:
Jitter supports multithreading, however it still seems to be a bit slower than PhysX.
Jitter has cone and cylinder colliders in addition to box, sphere and capsule ones.
Jitter seems to be able to check for intersection between a pair of arbitrary colliders. PhysX has CheckCapsule() and CheckSphere() methods only.
Jitter supports soft bodies.
Jitter is 100% managed.
Concave meshes can collide with each other in Jitter (however it is slow.)
Jitter is open source (and free for even commercial use.)
Jitter has no built-in character controller.
Jitter doesn’t natively support kinematic bodies.
…?
I wonder, does anyone have any experience with Jitter? What is it good at and what are its limitations? Do you expect any particular difficulties to use it inside Unity?
Thank you for the link. I will finish the wrapper for Jitter physics and then create a common benchmark scene to test the performance of all three engines.
The torus uses convex hull collider, other objects use primitive colliders.
White horizontal lines show fps levels. The lowest line is 60 fps, the next one is 50 fps, then 40, 30 etc.
I don’t have a Mac, so can’t build for it. And web player doesn’t work at the moment, I don’t know why yet. Jitter is 100% managed, it should work fine in the web.
I started to integrate soft bodies yesterday, but very soon realized that I would have to mess with mesh vertices. Not a big deal, but it would take time to do it properly. So, I decided first to implement terrain collider, compound shapes, constraints, joints and other basic stuff. PS: And reinvent character controller too.
I hope the performance of soft bodies will be acceptable.
It turned out that a proper character controller implementation is a pretty tricky thing. Jitter has not built-in implementation. There are examples on its forum and I’m trying to improve one of them. It runs fine except it slows down at stairs and doesn’t support moving platforms.
I’ve had Jitter working in Unity for years And in my testing it works fine in both web-player and iOS (and by extension, likely every other platform).
Initially I used it to prototype a MMO with server-side physics that went no-where, these days it’s in production thanks to the inbuilt support of capsules. Beyond that I enjoy the flexibility and power of the API - far beyond that of Unity’s physics. On the downside of course it’s not natively supported nor as matured/polished as the built-in systems.
It seems that web-player’s Mono doesn’t implement some method in ReadOnlyCollection which recent versions of Jitter implicitly use (I took the latest one from the repository.) It causes an exception inside IslandManager’s constructor. I changed ReadOnlyCollection back to List and now Jitter works again.
Have you used it on client side? Completely in background or just using its internal multi-threading?
I’ve seen demos of Jitter running fully in background inside Unity. That way it doesn’t affect fps at all, even if there are thousands of cubes on the scene. Looks impressive, however I expect a lot of synchronization issues:
The physics engine may update a body’s position or orientation when a user reads or writes to it.
The physics engine has to buffer collision events somewhere until the main thread is ready to fetch them.
I have no idea how to implement synchronous raycasts since the world is constantly changing in background. Locking the physics calculations isn’t the answer - raycasts will become very expensive, especially several ones in a row. But asynchronous raycasts will be a pain to use.