I’m working now on a planar cloth sim C++ extension. The actual code is not ready to be shared, but as soon as I have something less dirty, I’ll post it here.
The code is intended to be used for liquid surfaces more that for real cloth objects : the adjacency points are not movable and a little assumption concerning the axes is made when calculating normals.
Actual features :
- Generates a spring system from a planar mesh made of quads
- Normals are computed in a fast way, but could be more realistic
- Almost framerate independent
- One sphere collider
Planned features :
- Propagation of vertex color ( sci-fi but nice to watch )
- N sphere colliders
- Optimized collisions with AABB tests
If we consider that the points don’t move too much during the simulation, I could use a spatial indexation for collisions.
I spent a lot of time on the computation of normals, and I’m not really satisfied with the actual code. I didn’t manage to sort the neighbors of each point to perform cross operations in the right order, so for now, I correct the upside-down normals by hand assuming that they should have their Z component > 0