Rope

WebGL simulation

This rope simulation is written in CoffeeScript and compiled into javascript. I use ThreeJS for 3D rendering, but all the physics is written by me without an external engine. The rope is made up of particles attached to each other by stiff springs. In order to simulate stiff springs I had to slice up my timestep into smaller substeps (0.02s). My browser renders every 0.16 seconds at 60fps so I run 8 physics cycles every frame.

Use the arrows keys, page up and page down to move. Here is a tip for all the mac users: fn+up is page up and fn+down is page down.


Test it out right here!

You can download the source here if you're interested. Bare in mind that the javascript code is generated from CoffeeScript which makes it hard to read. Unfortunately I couldn't find the original CoffeeScript source.