r/tinycode • • Apr 01 '13

Soft body physics in 998 bytes of JS

Here's what I made for js1k. It simulates a bunch of soft body blobs, collisions between them, and collisions with a moving sine terrain.

You can attract nearby blobs with mouse.

http://js1k.com/2013-spring/demo/1485

Unminified: http://jsfiddle.net/kotsoft/5TAtE/

Explanation of the math: https://skydrive.live.com/redir?resid=1F7837CC1CC2B2A4!1377&authkey=!ANyjHFa2HUjF-YQ

102 Upvotes

12 comments sorted by

View all comments

3

u/seiyria Apr 01 '13

Do you happen to have an uglified version with some commentation that one could use to learn from/look at?

8

u/kotsoft Apr 01 '13

I have some unminified source here: http://jsfiddle.net/kotsoft/5TAtE/ Other features were implemented after minification.

1

u/NewAlexandria Apr 01 '13

great fiddle

1

u/seiyria Apr 01 '13

Very cool, thank you!