Google Gravity

Came across this from a Slashdot link, don't remember seeing anything about it here: http://www.chromeexperiments.com/detail/gravity/

Might require Google Chrome to get decent performance (uses the Javascript Box2d), but if you can try it, it's pretty neat, it makes all the Google page elements into rigid bodies that you can throw around.

Edit: while you're there, check out some of the other stuff at http://www.chromeexperiments.com/browse/, a lot of it is quite impressive - I remember playing around with the canvas tag a while back and being extremely disappointed, but it looks like it's come a long way!
Hey, glad to see that you liked it 🙂

I was wondering, I've been playing with this for a while already, and I have a problem that I can't seem to sort out, and it's the walls.

Walls = sides of the browser (left, top, right, bottom).

If you resize the browser I'm moving static boxes to the positions to match the size of the browser. This creates a weird behaviour because I'm moving the element without going through the physics. So you elements won't collide with the walls, they will slowly try to reach a appropriate position. In fact, if you resize the browser a lot you can even "eat" elements out of the simulation because they didn't collide with the walls when it was being resized.

Something I tried before was to, instead of having static boxes, having dynamic ones instead and using strings attaching every corner of the browser window to the corners of the boxes. That worked for the problem I exposed previously, but then all the elements were bouncing all the time in the floor (because the floor isn't static anymore).

Not sure if I'm making any sense...

Original thread: https://box2d.org/forum/viewtopic.php?t=2773