Adverti horiz upsell
Walk with an expression - DreamLab Database (Math Lesson)
Walk with an expression - DreamLab Database (Math Lesson)
sdb1987, added 2005-09-01 19:09:21 UTC 59,690 views  Rating:
(2 ratings)
Page 1 of 2

This database derives from a personal experiment using expressions. I was looking for a cycling mathematical equation that could allow me to develop almost any cycling actions in human characters and four legs animals.

This tutorial is divided into two parts: the first one is a little math lesson; the second is the database tutorial that will teach you to use the skeleton for almost any human cycling actions

I'll explain the expression procedure that to give you a better understanding of the math involved so that you will be able to produce similar or more advanced expressions in Maya.

If you are not interested in the complete explanation of the expression syntax, click on the database icons

Walk cycle

download "dreamWalk.mb" & "dreamWalkWindow.mel":

download sample avi:

Skiing cycle

A "little" MATH LESSON :

Note: I suggest you to try this first part of the tutorial in a new scene. Create a locator, or another object, and try the expression that follows.

If you don't create a locator, pay attention when you write the expression to use the appropriate name object.

The only think I knew about a cycling expression, at the beginning of this work, was that I'd have to use the trigonometric functions; I was afraid about that, because the last time I used those functions it has been 10 years later when I was in high school.

I started with the simplest expression I was able to think about: "locator1.ty = sin(time)". Form here I knew that I'd need variables to change the frequency and position of the locator animation.

Note: What's a variable? The variable, in math, it's just a value like "1, 2, 1.4, 3.9�.etc", the only difference is that it can change depending from your mood or from the expression execution.

So, the "sin" function return a value between "-1" and "1", that mean that the locator can't move higher the one unit up to the zero and one unit down. But when we walk or run we change the "value" of our step longness and highness; what we have to do now is to insert in the expression a new value that will change the highness of the locator, because this expression control just the highness. But if you understand the procedure you'll be able to reproduce it any time anywhere for any movement.

To change the highness we have to increase the value the function return (-1, 1). To do that we will multiply the value in this way: "locator1.ty = sin(time) *2". Someone could say: why don't we add the new value? Because if you do that you'll change the highness of the locator position and not its movement, I mean the locator will move between "-1 and 1" from the highness of the value you add, in this case "2".

That quest let you understand that if you want the locator change its position you have to add the value. try: "locator1.ty = sin(time) + 2".

And now we will introduce the "variables".

Select the locator and add a new attribute, call it "variable" or something like that. Put the min value at "-10" and the max at "10", the default value at "1".

Create a new attribute it's not necessary but it will help us to be more linear in the exercises.
Now go to the expression editor and create the variable as follow (MAYA wants you to declare the variables before you use them, like C and C++):

float $var = locator1.variable;
locator1.ty = sin(time) *$var;