Here’s a quick MEL wiggle expression for Maya’s transformation channels.
This is similar to After Effects’ wiggle() expression.

Step 1. Go to Channelbox > Edit > Expressions…

Step 2. Paste the following[av_tab_container position=’top_tab’ boxed=’border_tabs’ initial=’1′ av_uid=’av-6z13hp’] [av_tab title=’Translation’ icon_select=’no’ icon=’ue800′ font=’entypo-fontello’ av_uid=’av-5tytwd’]

$wiggleF = 3; //Wiggle Frequency
$wiggleA = 3; //Wiggle Amplitude
$wiggleV = 1.1; //Wiggle Per Axis Frequency Variant

translateX = noise(time*$wiggleF)*$wiggleA;
translateY = noise(time*$wiggleF*$wiggleV)*$wiggleA;
translateZ = noise(time*$wiggleF*(1/$wiggleV))*$wiggleA;
[/av_tab] [av_tab title=’Rotation’ icon_select=’no’ icon=’ue800′ font=’entypo-fontello’ av_uid=’av-3ry7z1′]
$wiggleF = 1; //Wiggle Frequency
$wiggleA = 180; //Wiggle Amplitude
$wiggleV = 1.1; //Wiggle Per Axis Frequency Variant

rotateX = noise(time*$wiggleF)*$wiggleA;
rotateY = noise(time*$wiggleF*$wiggleV)*$wiggleA;
rotateZ = noise(time*$wiggleF*(1/$wiggleV))*$wiggleA;
[/av_tab] [av_tab title=’Scale’ icon_select=’no’ icon=’ue800′ font=’entypo-fontello’ av_uid=’av-2xdm25′]
$wiggleF = 3; //Wiggle Frequency
$wiggleA = 3; //Wiggle Amplitude
$wiggleV = 1.1; //Wiggle Per Axis Frequency Variant

scaleX = noise(time*$wiggleF)*$wiggleA;
scaleY = noise(time*$wiggleF*$wiggleV)*$wiggleA;
scaleZ = noise(time*$wiggleF*(1/$wiggleV))*$wiggleA;
[/av_tab] [/av_tab_container]

Step 3. Adjust Frequency, Amplitude and per axis frequency Variant to liking

Note: By default, the translate Y and Z frequency has a 1.1 (and ~0.9) multiplication to vary the animation on all 3 axes to avoid spatial linearisation.

9 Comments

  • Cize says:

    Hello.
    Thank you for this, is amazing!
    I have a doubt.
    Is there a way to change the seed?
    I’m using this for a fleet of boats and all they wiggle to the same axis at the same time. I’d like to have all of them randomly. Could you help me?

    • Ronald Fong says:

      Hi Cize,

      A fleet of boats wiggling sounds the easiest to achieve using Maya’s MASH system. Have you tried it?

      If you’d still want to do things the manual way, try this:
      I haven’t tested this, so no guarantees it’d work.
      Each boat would need a unique seed inserted into the noise expression. In the case of translateY for example:
      int $seed = 123125; //introduce this new “seed” variable, each boat has to have a unique seed number
      translateY = noise(time*$wiggleF*(1/$wiggleV)+$seed)*$wiggleA; //observe where the $seed variable sits in the expression, and adjust yours accordingly

      cheers!

      • Cize says:

        Thank you so much! It helps a lot.
        I don’t know how to use MASH with existing geometry but I’ll give it a chance, tnx!

  • park says:

    In the case of translate, for example, can you set the value to give a noise between 5 and 10?

    • Ronald Fong says:

      Hey Park,

      I think so, although I don’t have time to test it now, but here’s how I’d approach it. Right now, if we set the amplitude to 2.5, we’d expect the values to run from -2.5 to 2.5, which is a variance of 5 in total. Adding 5 to this, we’d get a resulting output of 5 to 10.

      So I’d start by setting the amplitude to 2.5. Thereafter, I’d find a way in the expression to introduce the offset of 5.

      Hope that made sense and I wish you luck!

  • Javier Arroyo says:

    Thanks,

    So usefull

  • Abdulmalik Bukhari says:

    Hello,
    I am animating some camera shake, and I want to use the wiggle expression for the handheld feel, but I can’t seem to figure out how to set keyframes to the expression or have it start on a certain frame. Is it possible to keyframe the expression?

    • Ronald Fong says:

      hi! yes! you’d need to add custom attributes like “amplitude”, “frequency”, and “variance” on to any chosen controller, and modify the expressions to query the values of these custom attributes. That way, you can set keyframes on the custom attributes as per normal. Hope that helps!

Leave a Reply