Maya Wiggle Expression

 

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

$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;

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.

5 replies
  1. Cize
    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?

    Reply
    • Ronald Fong
      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!

      Reply
      • Cize
        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!

        Reply
    • Ronald Fong
      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!

      Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *