Unity 4.3 has just been released - it includes a brand new 2D physics system. The new physics system is based on Box2D and is great, but there a few missing features with Unity’s implementation.
Well, we’ve decided to fix that.
Physics 2D Extensions is a set of add-on components to Unity’s 2D physics system that add additional functionality.
Features included:
Fully compatible with Unity’s 2D physics system, building on top of native 2D physics
Wheel joints, rope joints, and weld joints
Joint break events
Buoyancy simulation
Wind simulation
Planetary gravity simulation
Works on all editions of Unity (Free and Pro), on all platforms that support 2D physics.
High performance - the code has been optimized for Unity’s specific 2D physics implementation. No needless run-time allocation is performed.
A familiar API - uses the same exact component structure, with all components properly exposed through both the inspector and scripting.
Includes a full example scene with every component
Coming soon:
Pulley joints
Explosion forces
Breakable bodies
Cloth simulation (One or two-dimensional)
Softbodies
And more! We have a bunch of stuff in the pipeline that we’ll announce later.
We’ll also be updating this package whenever Unity updates their 2D physics, to enhance any new features they come up with. And as always, we’re just a click away - Physics 2D Extensions will come with Thinksquirrel’s full product support.
The project is built as C# assemblies that build on top of the native physics API. The components hook into FixedUpdate, do their thing, and submit velocity/position changes to the physics engine. Actual native physics simulation is still done within Unity.
The Fluvio integration is handled differently, as that plugs into Fluvio’s existing API and physics loop.
There’s one thing which hopefully Unity will solve on their end - they provide no API for getting the inertial tensor/center of mass for 2D rigidbodies right now, so that calculation has to be redone (only once whenever a component is added, or collider sizes/physical properties changed, etc). This is still sub-millisecond time for any but the most complex scenes, though.
As for releases, we will be releasing with two editions, one with full source available.
The pricing I gave above ($25) is for the initial, non-source version, at introductory price.
Soon! It won’t be in the initial release - the initial version is polygon based, instead of the typical texture-based or marching squares implementation. With the 2D terrain, I’ll need to explore rendering options as the renderer I’m using isn’t ready for public consumption just yet.
Code [Finished] - I can happily report that there are ZERO (yes, 0 bytes) of memory allocation per frame, heavy caching, and as-good-as native code performance levels right now. Every feature listed in the first post under “Features included” has made the cut and is in the product at the moment. I also added a new DragControl2D component, that gives control for lifting and dragging objects. It supports the mouse, multi-touch, and custom input delegates.
Documentation [98%] - only the new DragControl2D component is left. All other components and the API are documented. Initial documentation is available as a simple README.txt, with online documentation coming soon.
Art [Nearly done] - once it is I’ll have a web player to publicly show.
This should be out to you guys by next week at the latest. Happy to hear the positive response from people who are interested!
Not sure how the final implementation will turn out, but there will likely be simple and tearable cloth components. The trickiest part about this is actually rendering, more so than the physics behind it.
Sure, why not - great idea! I’ll put it on the roadmap.