Not a question. Explanation of how the cube rig works

posted to: Arcs of Motion II

If you are like me and can't keep moving until you understand how this works, I wrote an explanation for myself that might help you out:

  1. As crissamarr said, go to File > User Preferences > File and enable Auto Run Python Scripts for the Gauge to work
  2. Now, when you move a slider on the gauge, the cube will stretch
  3. Switch to the Animation Screen layout (it's just my preference to see things more easily)
  4. Go to the Graph Editor window
  5. Make sure the Mouse toggle button at the bottom bar is deactivated to show all the channels of all the objects in the left panel of the Graph editor
  6. There is a dropdown that says F-Curve, open that dropdown and select Drivers to show the animation scripts
  7. Select any channel from the left
  8. Open the (N) panel and select the Drivers tab to see the content of the script
  9. Now that you know where to find the info, let's see how each gauge slider works
  10. Gauge's Bend_Control
    1.   This slider bends the cube like a bean to the left or right
    2.   This slider directly controls the Cube_curve object. TheCube object bends with the Cube_curve object because TheCube has a Curve modifier with Cube_curve as the object
    3.   To make the slider control the curve, two keyframes were inserted for the Cube_curve object
      1.   Keyframe 1: the Angle field of the SimpleDeform modifier of the curve
        1.     The purpose of the slider is to update this SimpleDeform angle easily by limiting the Z movement of the slider
        2.     In the Drivers tab of the (N) panel in the Graph editor, you can see the script to control the angle of the SimpleDeform modifier on the curve
        3.     The expresion is: var * -1
        4.     This means that the value of the Angle field of the SimpleDeform modifier for the selected frame will be the result of that expression. The specific result for the expression can be seen in the "Driver Value" section of the driver
        5.     The var value for the expression is found below the Add Variable button
        6.     The var value is of type Transform Channel and is called var. The Object to obtain the value from is Bend_Control (which is the slider object), and then the specific transform channel wanted is specified: Z Location and Transform Space.
        7.     If you move the Bend_Control object on the 3D viewport, you'll see that its Z location value will be exactly the same as the one shown in the "Value:" section of the variable definition
      2.   Keyframe 2: the X location of the curve
        1.     From the way I see it, updating the X location value was needed to offset the curved when deformed by the SimpleDeform modifier to keep it centered
        2.     The expression is a little bit more complicated. It's result will be the value of the X location for the selected frame: 0.011 - (var * 0.45)
        3.     The var value is of type Single Property and is called var, the Property is the Cube_curve and the specific Path to find the value to use as var is modifiers["SimpleDeform"].angle
  11. Gauge's SquashControl1
    1.   This slider stretches the cube vertically and squashes it horizontally
    2.   This slider directly controls TheCube object
    3.   To make the slider control the cube, two keyframes were inserted for TheCube object
      1.     Keyframe 1: Value (Stretch)
        1.       If you go to the Properties panel > Data tab > Shape Keys section, you'll find several Shape Keys created
        2.       This keyframe was created inserting a keyframe for the Stretch shape key
        3.       As you can see in the Graph editor, the expression is simply the value of the var
        4.       The var value comes from the Z location of the SquashControl1 object
        5.       If you want to manually modify the value of the shape key to see how it affects the mesh, you'll have to remove the driver in the Graph Editor by clicking the button Remove Driver in the Drivers tab. Otherwise, you won't be able to modify it
      2.     Keyframe 2: Value (Squash1)
        1.       Same logic as the Value (Stretch) keyframe, but the expression is: var * -1
  12. Gauge's SquashControl2
    1.   Same logic as SquashControl1
  13. Rotator1 and Rotator2
    1.   These are simple empty objects that act as the parents of the CubeMaster object through the use Child Of object constraints
    2.   The CubeMaster object has two Child Of object constraints, one for Rotator1 and another one for Rotator2
    3.   As you would expect for any object with a parent, when you rotate the Rotator1 object, its child (CubeMaster) is also rotated. The same happens with Rotator2
  14. And why does the Gauge seems to follow TheCube?
    1.   Because the Gauge object also has a Child Of object constraint. This object constraint sets the CubeMaster as the parent of the Gauge
    2.   The Gauge only follows TheCube in the X axis because the rest of the transformations are unchecked in the Child Of constraint, so only the transformation in the X axis is allowed
  • Julian Darley(juliandarley) replied

    hi maria luisa,

    thank you so much for posting this, it's extremely interesting and helpful.

    best wishes,
    julian