Posted on

Verlet Is Still Neat

I spent my time coding up some more of the verlet implementation. In addition to points and edges there are now bodies that are just a collection of pointers to the vertices and edges that make them up. The bodies came to be because I needed something to use for collisions. So now bodies use the separating axis theory to test for collisions and the colliding edges and vertices are nudged away from each other when they collide. The crazy thing about verlet is that it works out great. In pushing away from each other the other edges in the bodies stop being their desired length and when the constraint function iterates it sorts them out and produces believable post-collision motions. Objects collide and go spinning away in a satisfying way. All that from a bunch of points trying to maintain distances from each other. It’s wild.

 

update:
It’s all working out great. Here is a video of some boxes I made. The little X inside each one is another set of constraints each box needs. Using only the 4 sides of the boxes as the constraints would let them flop over and collapse.
I can play with the strength of any edge or simply how many times the constraints are iterated each frame to make them more or less resistant to changes in shape.

Until I implement friction I’ve just got a global damping slowing down all the boxes.

Advertisements

About David Grenzowski

i play videogames and then i write about videogames i am mad videogames

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s