this is my first REAL contribution to the Irrlicht community: a CClothSceneNode to simulate Simple Cloth Physics!
Quick Screenshot of my demo in action:
![Image](http://upload3.postimage.org/368525/CLOTH.jpg)
Get the Demo and Sources here:
(link removed, sortof died, need to reupload)
What is it?
It allows you to create a Cloth entity from any Irrlicht IMesh, and then after setting a few simple parameters, you can make it behave like Cloth (well, almost
![Wink ;)](./images/smilies/icon_wink.gif)
I'm not very good at explanations, so I'll just say that try out the demo to see what its all about (source included)
A picture can tell a thousand words, so check out my MSPaint skillz:
![Image](http://upload3.postimage.org/368509/Explanation.jpg)
How to use it?
Check out the sources I've included: its a simple 3 step process really
1: Create the CClothSceneNode
2: Apply Pinners
3: Apply Forces
How does it work?
I've used a very simple Verlet integration method (somewhat similar to the Cal 3D approach) to manipulate a set of Springs created based on the Polygon data of the IMesh which you pass in.
Mathamatically speaking, its not at all 100% fail-safe, because it should be using very accuratly calculated timed steps, but it gets the job done the way it is...
Known Limitations, Bugs, stuff still To Do
-Doesn't work with all Model Formats?!
I tested it with an OBJ format file, but it gave very odd results; X files seem to work fine though... still need to do a lot of testing.
-Only uses the FIRST Mesh-Buffer of an IMESH!
which means, its practically useless for large, complex meshes. But should be good enough for simple things.
-Pinner shapes
only uses Spherical Pinners for now, but Box and Cylindrical Pinners can be more helpful sometimes too
-Collisions!
self-collisions dont occur so you can sometimes endup with strange behaviour, like corners folded over, etc.
and offcourse, collisions with OTHER objects would be nice to have too...
-Cloth parts for IAnimatedMeshes
wouldn't that be cool...
![Wink :wink:](./images/smilies/icon_wink.gif)
OK, I admit it.
I've made a premature public release; a lot of things simply haven't been implemented which should have been;
but I have my own reasons.
Simply put, I just won't have the free time after this week, so I figured I'd just make it public ASAP and let everyone help out to make this as useful as it can be for the future... the potential is immense.
I'd love to see Irrlicht become more recognised - Niko and the team deserve more credit than they are given, and only by sharing these kinds of implementations, we can ALL help to achieve that, and make Irrlicht better for everyone at the same time.
The spring system is more-or-less complete and can be used for other things; as I said before, i'm interested in creating a FastLSM softbody implementation for irrlicht, and an implementation could be build using this spring-system instead of the stuff outlined in their paper.
oh
sorry for using the GB-flag, but the Irrlicht Logo just didn't feel right... well, you get the point.
Any problems, Ideas, improvements, Tests, etc, let them loose in this topic so its easier to keep track of.
Have fun!
![Very Happy :D](./images/smilies/icon_biggrin.gif)