AutoInertia - Driver Script

Hi- thought I’d share a script I wrote for Blender to automate secondary motions while animating. This python script defines a driver function that automates physically accurate inertia. Dampening and mass can be adjusted to create a distinct range of motion. Applications include muscle and fat simulation, tail or tentacle animation, and elastic material simulation.

Please give me feedback on how to improve! I’d be pleased to see this applied in animation projects. Instructions such as variable order are included in the python file. To install, simply load in the text editor, check “register,” and run! (You’ll also have to enable auto-run on python scripts in the system preferences)

The script can be downloaded here: https://www.dropbox.com/s/b20s7jxmq8q384b/AutoInertia.py


Hi,

Can You please make a tutorial how to use it?

Cheers,

I can try to explain here. This is for one axis and can be repeated for each axis. I have one target object named “Target” and another object named “Inertia” that will be affected by the script.

Here is an example file if needed (Blender 2.71): https://www.dropbox.com/s/0ewu3azgn1lbtn3/AutoInertia%20Instructional%20File.blend


  1. Go to User Preferences > File > enable “Auto Run Python Scripts”
  2. Load AutoInertia.py into the text editor. Enable “Register” and run the script
  3. (at the bottom of the object panel) Add a custom property, preferably corresponding to the axis of motion you’ve chosen (I’ll choose x here). I named mine “x prop” and set the max to 1000 and min to -1000. These are actually max and min for speed.
  4. Add a single driver to “Inertia” for the chosen transform axis and open the graph editor. Switch it to Drivers mode
  5. Bring up the Properties menu in the graph editor and delete the default variable
  6. In the expression box, type
AutoInertia("Inertia", "Target", 0, 0.1, 0.5, "x prop")

The arguments for the driver script are:

AutoInertia(inertia_name, target_name, axis, mass, damp, velocity_property)

First argument = name of the object with inertia (in quotes).
Second argument = name of the target object (in quotes).
Third argument = axis of motion. x = 0, y = 1, z = 2.
Fourth argument = mass scalar. Goes from 0 to 1. 0 = fast and light motion, 1 = slow and heavy motion.
Fifth argument = dampening. Goes from 0 to 1. 0 = sustained, 1 = dampened.
Sixth argument = name of the custom property created earlier (in quotes).

  1. Play the animation (Alt-a) and drag the target object around.

finally, but you have to make this an addon, it’s seems hard to use… i’m an animator and yeah, looks awfully complex so far, i’ll give it a try anyways… can it be used in bones?

test animation, bones also… blender 2.71, open file and play.


https://www.dropbox.com/s/s7ypb7rxlv1j95a/AutoInertia_test_anim_01.blend

it looks very useful. :slight_smile: Animators will be very happy (me). But “x prop” does not work for me. I tried slider, but without an answer in animation. Everything was going to start.
It is very quick test, @AnsonAdams27 make your own animation file please.

Very cool test! I had never thought about using to drive rotation. I played around with it a little- instead of driving the rotation with AutoInertia, I made each cube track to the next with a constraint. Also played around with the mass/dampening values to make another one jiggle.


https://www.dropbox.com/s/spm5db7riswdqvd/AutoInertia_test_anim_01_v2.blend

Below is a link to the tail rig demonstrated in the picture. It takes the same concept of chaining to the next level. To move/rotate it yourself, you can disable the root bone drivers that make it move automatically.


https://www.dropbox.com/s/8b26yxba3n40ibq/AutoInertia%20Tail%20Rig.blend.

When you say “x prop” does not work for you, are you referring to when you’re using it on the bones? As of now this doesn’t support directly driving bones, but you can parent bones to empties that use AutoInertia. Please see the tail rig as an example (press Alt-h to show the hidden empties).

Congratulation! Nice example of animation and very clever structure of “rig”. I must study it closely.
But for some people this example is a little bit complicated, I think. :slight_smile: We need “own tail” ( curve or bones), run your script and everything will be done. Like “rigify” addon. We do not know how it works, but after some clicks we have result. This is good way for us. Please think about it.
AutoInertia with bones rotation ( drivers) is very simple. Driver for each rotation axis and complex motion is prepared without dynamics. Thank you very much! I will be playing with it.