If you edit the expression and you have open the "attribute editor" or the "channel box", when you play the scene and change the value of the variable, the locator will change interactively its highness. If you do the same think with the other expression (locator1.ty = sin(time) + $var) the locator will change the y axis position.
Now some would like to change others parameters like frequency. To change the frequency we have to virtually change the value of the time, I mean we'd want the time to go faster or slower. What we can do? It's quite easy: take the time and multiply or divide it:
locator1.ty = sin(time *3) *$var;
In this case the frequency will three times faster. Another time we will create a variable that will allow us to change the value of the frequency. Select the locator and add a new attribute. Call the attribute "freq" or some thing like that, set the min value to "0" and the ma value to "10". Now write the new expression:
float $freq = locator1.freq
locator1.ty = sin(time *$freq) *$var;
Now when the scene plays you can change the two variables and see what happens.
That's all you have to know to analyse and understand the expression I built in the database. You'll probably find something strange in the expression syntax, like variables declared that seem to be stupid, but the more you use variables the more your expression will be readable, not only to the user but also to the computer.
Finally we will analyse together one of the most complex expression in the scene:
float $var = control.walk;
float $hh = control.hipsHigh;
float $dum = control.dum;
float $sh = control.shlodHigh;
float $ho = control.hipsOsc;
float $run = control.run;
$ty = sin(time *$var) + $run
$bac = $hh + (sin(time *($var) *2)) *$dum;
joint10.translateY = $sh + ($bac + ($ty *$ho /3));
The lines declare the variables; than you have the first expression you want to be calculate before the joint start to move.
WHY? That's because if you put all in a single expression the computer may read the expression in the wrong way, in this case you have two expression one execute first than the value will be put in the second and at the end you have the joint movement. This is longer to read for the computer but it's much clear.
Note: the "if" statement: "if ($ty >=0)" tell to the object: "you can return negative value, if you will try to do that your value will be zero" (that's because when we walk we touch the ground).
But, when we run or when we take the bicycle or something else you want, we don't touch the ground or we touch it just a few. The "$run" variable let the if statement to be not equal to zero so the feet will start to touch the ground just a few since the value of "$run" it'll be "1", then they will not touch the ground any more.
Note: any time you use a trigonometric function or any time you use an expression with just a multiplication be careful that the variable will not be equal to zero because the expression will stop and an error will be returned.
ANY NUMBER MULTIPLIES FOR ZERO RETURN ZERO AND EXPRESSION WILL NOT BE VALID.
If you analyse the expression: "moveExpression", any time there is a trigonometric function you also have an addition to let the result being grater than zero.
I'm a physician not a mathematic, but I'm sure we don't need to be mathematic to use complex expression functions, we just have to be smart and try, try again.
Thanks for your attention, enjoy with this database.
please feel free to contact me for any suggestion, bug report or other information.
If you will use for any kind of production or you think to have created a nice character, please contact me.
ciao,
Federico "doc" Cascinelli.
www.dreamslab.com
fit@dreamslab.com
Author: sdb1987
Submitted: 2005-09-01 18:59:15 UTC
Tags:
Software: Maya
Views: 59,779
Related Items
-
robot with an eye 3D Model
$20.00 (USD) -
TTools - Pro - Professional Tools 7.0.0 for Maya (maya script)
$29.99 (USD) -
Curve Tools for Maya 1.3.0 (maya script)
$25.00 (USD) -
t-mobil G1 with android 3D Model
$130.00 (USD) -
Willson Rig with advanced facial controls for Maya 0.1.0
$20.00 (USD) -
Wash-bowl with mirror 3D Model
$20.00 (USD) -
Decorative jar with handle 3D Model
$23.00 (USD) -
White Tiger with animation 3D Model
$40.00 (USD) -
Dressing Table With Chair Dresser 3D Model
$9.99 (USD)