Playing with Verlet Integration

Keith Peters presentation at FOTB was on the last day, at 9 am. Not necessarily the best time for “Advanced AS Animation” :D I was wide awake though, as soon as he started talking about Verlet Integration. The presentation slides are up on his blog. Keith also provided this gamasutra link for more info.

I was compelled try it out. It’s like magic, such simple math, yet, the result looks like the work of a physics genius! Here’s my first test : The Verlet Polygon Explorer

verlet polygons explorer screen shot1

It’s a Flex project, I added some widgets to make “playing around” easier. You can change the number of shapes, change the force of gravity, the “rigidity”, even add some wind and bounce the little bastards…


verlet polygons explorer screen shot1

verlet polygons explorer screen shot1

This really is a powerful approach in terms of performance. I only started to drop below 30 frames per second after 70 shapes… Naturally, “rigidity” adds a lot of overhead (number of times each “update” is calculated per frame).

Click the link above or images for the demo, source files can be downloaded here.

I’ve got a bunch of ideas for stupid experiments, but also for some real applications… This is a great tool to add to any flash developers bag of tricks! Thanks Bit-101!

Tags: , ,

2 Responses to “Playing with Verlet Integration”

  1. David Says:

    Damn, this is hot! I’ll have to check out that Gamasutra article and mess around with it a bit. I can image tho, that doing collision detection on other objects can be a bit intensive with enough polygons/sides. But then again, it doesn’t have to be :)

  2. Sam Danielson Says:

    Very cool demo. Even numbered polygons greater than squares are really soft. 5,7,9-gons all hold their shape much better at a particular hardness than shapes with 6 or 8 vertices. Why is this?

Leave a Reply