Animating with Expressions - The Begginers Basics
By Michael Malinowski
||For this we will begin to look at the benefits of using reasonably
basic expressions to automate animation within XSI. Although daunting to
begin with it is actually quite simple to begin with.|
We will start by creating an object which will bounce at a speed and height defined by a series of controls we will also create.
||Now create a polygon mesh / sphere, this will be
the only object that we attach expressions to. Call this one
||Making sure we have the bouncy ball selected click on the
"selection" button in the selection panel, this will show all the property
sets of the bouncy ball, we need to view the local transform properties
within the kinematics properties. Kinematics being the scale, rotation and
position of the sphere.|
You will now see the property page of the local transform values, you can set expressions on any animatable parameter, but for this we will begin by choosing the Y axis on the position section.
Right click the animate button and choose set expression.
the part where we actually learn something. First of all its important to
understand how XSI calls upon properties and the way it is written. For
instance to call on the value of the position along the X axis that the
speed control is currently at, it would be written like this :
Put simply, first we
define which object we want to call a value from, this time being the
speed control, then we need to start defining the route we need to go to
find the value, so we tell it we are looking in the kinematics properties
(shortened by typing "kine", followed by the local transform properties
(shortened by "local") finally selecting the actual value field we are
taking our figure from, this time being posx, short for position
||For this tutorial however we want the ball to bounce up and down
without actually having to hand animate anything within the scene. This is
where we all wish we actually listened in our math classes back at school!
XSI understands functions such as sine and cosine, which makes our job much easier, as these create a wave pattern which alternates from one to zero and back again.
We may as well see this in practise to fully understand what's going on, so with the bouncy balls local transform property page still open right click the Y axis and choose "set Expression".
This will open an expression editor. This is where we type what we want it to do, copy this into the editor:
Sin (fc * 20 ) * 10
press the play button you will see the sphere start bouncing up and down.
The Sin function allows the values to pass from one to zero then back
again, the FC is the animated function curve that all the animation in xsi
is controlled by, the 20 is the distance the ball will move leaving the 10
being the speed in which the ball will travel at, by changing the figures
we can immediately change the animation that is effecting the movement.
Sin ( fc * bounce_Control.kine.local.roty ) * 10
that set as the expression you should be able to rotate the bounce_control
object to effect the distance the ball moves.
I hope you found this tutorial of some use, if you spot any errors throughout it then please let me know... firstname.lastname@example.org