When I first received the Unity 3.0 Beta one of the first things I played around with was the new cloth physics. What better way to learn something than to make a tech demo. After some thought I decided on creating a parachute.
One thing I quickly discovered about the new cloth physics within Unity was that it is very heavy (requiring a lot of computing power). That means for the most part cloth physics are slow. So before you go off and try to create a game with lots of physics based cloths you have been warned, it will probably end up being too slow. While cloth does have its uses, they are a little more limited than I had hoped.
My original plan for this demo was to build a parachute using only cloth physics. I ended up having to tweak this a bit for performance reasons. Since in real life a parachute moving downward is fairly rigid so I instead opted to only swap in a physics based cloth once the parachute’s payload touches the ground. The rest of the time I would use a normal mesh renderer. This way I can get the parachute to collapse nicely over the payload but only use the physics aspect for a short period of time.
The parachute’s movement is completely driven by the physic system. A configurable joint is used to attach the Rigidbody of the parachute to the payload (in this case a crate). A physics force is then applied to the parachute based on the maximum amount of lift that parachute is capable of. This way if you increase the mass of the payload the parachute will fall faster and on the flip side a payload of less mass will fall slower.
I ended up leaving the Interactive Cloth’s options pretty much unchanged as changing some of them ended up impacting performance too much. The parachute’s cable are dynamically generated using LineRenderers.
This example is built is such a way that you should easily be able to attach whatever you would like as the parachute’s payload.
To check out the demo click here.
To get the source (unitypackage) click here.
Source Requirements: Unity 3.0
Thanks again to Calin for creating the models.