'Maya'

 
'Setting up animation controls in Maya' by Martin Andersson


f(x) = sin(x). Sounds familiar? Good. If not, let's take a minute to explain the sine function. Sine, Cosine and
T angent are used much in trigonometry. The unitcircle is a very good tool when it comes to angles and these
mathematical functions. Let's take a look at the unitcircle.

Looks confusing? Well, let's strip it down. Notice the triangle at 30 degrees.We use sine to determine the value of the opposite line. ( .sA ) and cosine to determine the nearby line.
( .cA ) sin30 = 0.5, cos30 = 0.866.

Look at the two axis in the circle. You have X from "-1" to "1" and Y from "-1" to "1". The sine value is read from the Y-axis ( see dotted line ) I'm going to take a trip all the way around the circle and list the values I get:

The values in paranthesis are the distance traveled on the circle. You don't have to understand this to get the point at the end.

sin30 = 0.500
sin60 = 0.866
sin90 = 1.000
sin120 = 0.866
sin150 = 0.500
sin180 = 0.000
sin210 = -0.500
sin240 = -0.866
sin270 = -1.000
sin300 = -0.866
sin330 = -0.500
sin360 = -0.000

See a pattern here? The sinecurve has a characteristic swing. Let's make the graph with the value in the Y-axis and the distance traveled in the X-axis.



If we take a look at this graph we see that the sinecurve is a neverending curve with the same pattern all over. If we go two rounds around the unitcircle ( 720 degrees ) we would end up at the y-value 0 and 4 pi.

How is this usefull for us? If you are an animator you have already told yourself that this graph represents a repeating wobbleanimation or it could be an elevator with smooth translateY etc. etc.

We want the curvature on the plankBendDeformer to go from "-1" to "1". The sinecurve is perfect for this so therefore we write an expression where the value of the attribute "curvature" is controlled by a sinecurve


3 - Let's try sine out. Grab the pStone and right-holdclick the translate Y attribute. Go to expressions... and set select filter to by expression name.

Call our new expression "stoneTranslateYSine" and press enter. Now write this into the expression - textfield.

pStone.translateY = sin(90); and click Create.

Maya returns the rather odd result 0.894 (read the translateY attribute, now marked purple/lilac because an expression is linked to it ) I'm not quite sure why this is, but I recon maya reads radians since sin(deg_to_rad(90)); returns 1

Fear not, we can use sind ( sinusdegrees ). sind(90) will return "1".

If we use sind(frame) instead of a set value maya will fill the current frame in. e.g. at frame 10; sin(10), at frame 90; sin(90) Try this one out and hit play.

pStone.translateY = sin(frame);

If you have the timerange set from 0 to 90 you can see that it takes 90 frames to get the translateY to "1" If you've been paying attention you should be able to guess this result before you saw it in Maya. We are getting somewhere now.

We want a higher frequence. Taking 90 frames to get half a sinecurve isn't quite usable. I tried a couple of values and this is what I am looking for:

pStone.translateY = sin(frame*56):

It's rather quick, but I'll use the vibrateValue to ease it in and out later. Now I want you do one last thing with the stone before we go to the plankBendDeformer.Go to "Edit - Keys - Bake Simulation/optionBox".

Reset the settings ( Edit - Reset Settings ) and change Channels to "From Channel Box". Set Time Range to "Start/End" and set Start Time to 0 and End Time to 90. Select pStone.translateY in the channelBox and hit Bake.

Maya will now bake the animation by reading the value at each frame and set a key. Let her finish and open
the graphEditor ( Window - Animation Editors - Graph Editor...) And... We're in sine-land: