News for hackers. Stuff that matters.
Re:Cloth by gosub100 on Saturday April 26, 2025 @09:05AM (#43803255)
it's not that difficult. in javascript, you represent each point in (x,y,z), give it a mass, and every frame apply gravity, maybe with some noise added. every time the particle tries to move, you use trigonometry to transmit the forces through the edges to the other points + some damping amount so it doesn't runaway. the mass determines how much each point is affected by subsequent forces.

If you aren't ready for it in 3d, do it in 2d.

Re:Cloth by jeffreygoesto on Saturday April 26, 2025 @09:58AM (#43803684)
Then you read into things like runge-kutta and implicit methods that make your little simulation not blow up...
Re:Cloth by diss on Sunday April 27, 2025 @02:11AM (#43809799)
This example actually appears to be 2d.