Andrew Brozek

CMPS 161 Winter 2010

Physics-Based Procedurally Generated Animation

My goal for my final project was to experiment with physics-based procedurally generated animations to animate characters.    I was inspired by the systems seen in current generation video games, such as ragdoll physics and naturalMotion.   For this project, I first constructed a stick figure.   This figure consists of many nodes that make up key areas of his body, such as hands, feet and head.  Then I connected these nodes with lines to represent limbs.

 

My figure

 

However, this figure is not just a static drawing.  First, I added a simulation of gravity to the world.  This simulation pushes down on each node at a constant rate, trying to drive them into the earth.  Next, I repel this downward vector by having the figure itself exert a counter force upwards.    Because these forces are balanced, the figure stands upright.  Furthermore, I attempted to simulate the fact that the counter vector was being generated by the figure itself.  There is a slight randomness to the amount of force exerted by the figure, so if you watch the figure closely, you will see the nodes move slightly up and down.   I try to add this variance to all the animations to make them look more fluid and lifelike.    The counter vector itself, like the animations, is generated with the feet and moves up the body.  The arms hang down and are dragged along with the body. 

 

The path of the force vectors. 

 

The animations involve adding additional force vectors.  First, I tried to have the figure jump.  The figure jumps by pushing up from the ground with its feet.  This force is carried up through its legs and body.  The arms are pulled upwards to stay with the body.  The force on the figure decreases until gravity overpowers it, and the figure falls back down to earth.  Again, the point is to generate an animation and not just to create a static jumping animation.   The figure has the goal to jump up; however, the force it generates in its attempt to jump varies.  It jumps at a different height each time.   It also tries to jump up in a strait line, but this also thus can also vary.  In other words, every time you press the jump button, the figure may either jump very high strait up, not very far to the side, or anywhere in between.  

The second animation I attempted was to simulate walking.  This too only involves applying a force to the feet.   The feet lift up and come back down, and the rest of the leg follows in a realistic motion. 

 

Example of walking

 

The hardest part of this project was the physics system, or rather, how to implement it.  First, there is a global physics system, telling the world what forces, such as gravity, are at work.   Then there is a system that breaks that down into how each node should be affected and crates a persona force vector for that node.  Then the body is also interconnected, so a force that affects a node will work its way up through the others.  Usually, only the feet have the initial force applied to them and the body’s system does the rest of the work. 

 

 

I’m happy with what I ended up with.  This was an experiment in how I could use physics to create animations and I like what turned out.  All of the animations were naturally created using a physics simulation.  Instead of a key frame, I just set the figure to apply a force to one of its nodes and the rest of the body follows.  This kind of animation is very exciting to me, and I would love to see an application of it in today’s video games.  Static animations where the player has seen every action a million times gets boring.  But this way, the animation is always different because it is generated on the fly.  It’s cool when something you create, creates something of its own. 

Type ‘main’ to run, or ‘main2’ if you have a faster computer.

 

Controls:

 

‘j’:  Pressing j causes the figure to jump.  Press j again to have the figure jump again once it lands.

 

‘w’: Press ‘w’ tells the figure to begin walking.   The figure just walks in place so the user doesn’t have to mess with the camera.  Press ‘w’ again to make it stop.

 

‘d’: Press ‘d’ to have the figure dance!   Press d again when you don’t want him to boogie anymore.

 

A note for computers with different speeds:  Some computers run the animation faster then others.  ‘Main’ was built on my windows platform and it runs at the appropriate speed.  However, when I ran it on the sun systems, it was way too fast. So I added main2, which is much slower.  If you find that the program is running too fast, than just switch to main2 by typing that in instead.   

 

 

 

Just Dance!

 

 

My Source