schteppe / p2.js

JavaScript 2D physics library
Other
2.64k stars 330 forks source link

Cloth #205

Closed tracend closed 8 years ago

tracend commented 8 years ago

Great lib. Maybe I missed it but I haven't seen any cloth simulation. Do you have plans for that?

How about incorporating some of this logic (with proper credit of course) https://github.com/Dissimulate/Tearable-Cloth/blob/master/Cloth.js

Cheers

schteppe commented 8 years ago

Thanks! No not really, but I agree it would be cool to have such demo.

Note that p2 wouldn't be able to compete performance-wise with other libs dedicated to cloth simulation. To get nearly as good performance, one would need to be able to turn off the Broadphase completely, as well as anything that has to do with rotation.

tracend commented 8 years ago

I see. So would you propose to use another lib for cloth simulation (which in most cases would be for visual effect) and keep p2 ligthweight so it can be more performant dealing with the core physics?

schteppe commented 8 years ago

Yes. It would need a lot of specialized code for p2 to keep up.

If you only need cloth sim and no collisions and no rotation, no inertia or shapes, then using something else would reduce download and increase performance greatly. But if you need a cloth interacting with rigid bodies, then use p2.

tracend commented 8 years ago

Cool, tnx for the heads up.