the bouncing ball – a classic protagonist in animation. but how do you setup a good way to animate the ball jumping around including its squashing and stretching? here two basic setup proposals:
create a sphere and name it ball (obviously) and move it up so the is ‘sitting’ on the grid. group this ball three times to itself and launch the hypergraph window. name the three group nodes above the ball from top to down: move, rotate and squash. the order of those transformations is important, else you’ll encounter problems when animating. now select the ball and add a squash deformer (create deformers > nonlinear > squash). move the squash deformer down (distance: radius of your ball) and enter the attribute editor: low bound should be 0,0,0 (where the ball is touching the grid) and the high bound should be a bit higher than the ball. now parent the handle to the squash group within the hypergraph. now you can animate your ball using the group nodes. it is recommended to lock (and hide) the unnecessary attributes in every group node: lock rotate and scale in the move group node etc. this way you can assure that you don’t change values in the wrong group node accidentally.
the other way is done through a little bit of mel scripting: do all the steps mentioned above and stop when you have set up all group nodes and named them accordingly. select the squash node and add an expression (window > animation editors > expression editor) by naming the expression ‘squasher’, selecting scaleY and typing in the following expression (case sensitive! squash is here the group node name):
squash.scaleX = 1/squash.scaleY;
squash.scaleZ = 1/squash.scaleY;
press create and you’re done. alternatively you can just type in:
sx = 1/sy;
sz = 1/sy;
maya will automatically extend this script to the one mentioned above. now you can control the squash of the ball by changing the value of scaleY through the channel box or by selecting scaleY and changing its value by scrubbing the middle mouse button within the viewport (which is quite intuitive). i prefer this method since i don’t have any additional elements within my viewport and doing all this by an expression is just hassle-free. it’s also recommended to lock the unnecessary attributes in each group node to ‘protect’ them from used in a wrong way (e.g. rotating when the mode node is active) as mentioned in the first setup.
some additional notes:
- add new squash group nodes if you need more squashing centers (like having one on the top or on the bottom of the ball to have more flexibility when animating).
- be sure the channel box shows long or short names, not nice - this will just cause troubles when scripting (since the nice names are not the ones to be used within mel scripting, so this can cause a lot of confusion).