If you click on the above image (then return here) you will spot that the real final expression for the shaker node is vastly more complex than what we have achieved so far.
It is not as complex as it looks though. In essence it is what I have so far explained but incorporates all the controls and also has that 'if/else' statement to allow for conditions where the wander intesity has been set to zero and no cumulative movement is needed.
Lets look again at those custom attributes that were set up on the shaker node on page 1.
Firstly there was a main intensity setting for each animation property:
Then each function had a master intensity control for each translation and rotation channel. The exception was Wander which, as explained earlier, only acts on tx ty and tz:
NB.1. all these custom attributes were added as floating point values in the arbitary range of 0-10.
You will note that the destabilise fine controls here read "destabilise_xxxxx_scale"
- they are not fine tune intensities but fine tune scale adjustments. More
on this later.
The one exception is the Destabilise fine channel controls which, you will remember, were named "destabilise_xxxxx_scale". This is because they do not increase the intensity or amount of desatbilistaion (only the main destabilise_intensity parameter does this). Rather, they scale the noise (time) function so that more destabilisation occurs per second.
Remember that our skelton expression for destabilistaion was:
the_shaker.tx = noise (time)
this produced a smooth yet random change in movement. Well by multiplying the time variable the movement remains smooth but happens quicker. There is a greter rate of change of movement per unit of time:
the_shaker.tx = noise (time * destabilise_xtrans_scale)
The final trick to mention is the if/else statement or conditional statement as it is referred to.
Remember that wander was created using the idea:
x translation = xtranslation + random number
Well if the user has set the wander to zero the random number part of the wander expression will also be zero (once it has all its variables incorporated) but the existing xtranslation will still be added to the other animation effects. In short, the node will still wander.
To get around this the final expression first identifies if the wander_intensity = 0 or not. If it is then the_shaker.tx is given a value of shake + destabilisation + jitter. If it does not equal zero then a second statement (after "else") comes into play and the_shaker.tx is given the value of shake + destabilisation + jitter + the_shaker.tx (its current value) + wander.
It may sound confusing but essentially, if no wander has been set the random offset values generated by the other 3 properties need to be applied directly to the channel in question as opposed to cumulatively. Trust me, it works !
The final part of this piece of work involved me writing a simple mel script to create my own window with all the controls at hand - far neater than the attribute editor.
Here you can download the_shaker.mb and the_shaker.mel and view the accompanying read_me file.
Best bet is to import the shaker.mb and make it the parent of a camera or object. Then source the_shaker.mel from your script editor and if my custom "shakecontrol" window does not appear, type "shakecontrol" into the Maya command line. If you have problems you can always control the node from the channel box or attribute editor. Play around with the sliders and watch. You might be playing for longer than you think !
NB you may have to right click on these links and choose "save file" in order to download or shift click
(updated spet 2005 so it works, thanks to matt oursbourn)