Try to recreate http://napephys.com/samples.html#swf-DestructibleTerrain in Javascript.