|
|
Softimage XSI Expressions Tutorial 1Level: Beginner by Raffael Dickreuter www.xsibase.com www.raffael3d.com In this tutorial you will learn how to use expressions to make a ball jump and to connect it with a custom slider to control the amplitudes. |
|||
Create The Objects Get > Primitive > Soccer Ball You could also create a basketball or a vollyeball, whatever you want to use. ![]() Adding Expressions Open Up an Exlorer and under Then expand the Local Transform properties of the soccar ball and right lick on the "Y" of the Position parameters on "Set Expression". ![]() Note that SoccerBall.kine.local.posy is the parameter that will get the expression applied to it. In the input field in the expressions editor add sin( ( Fc * 4 ) * 4 ). Click Validate and then Apply. If no errors are found the expression is added to the parameter. We are applying a sinus function. Fc stands for "current frame", so at each frame it will be recalculated. ![]() Click the Play button to check the animation. The ball is moving up and down a bit. Not yet what we want, but the ball is moving. In the graph editor click on View > Graph Editor. Now you can see the function curve of your formula. ![]() As you can see the cuve is also going into negative values. If we want to make sure our ball just hits the ground and them jumps up agin change the forumla to abs(sin( ( Fc * 4 ) * 7 )). abs will change every negative value into the equivalent positive value. Always handy for cases like this where you don't want negative values. Now check agin how your graph looks like. Play again the animation to see how it looks like. The ball is jumping and hitting the floor. ![]() Now it would be great if we could easily control how much the ball is jumping. For this we will add a custom parameter. Adding a custom parameter In the Animation panel click on Create > Parameter > New Custom Parameter Set... Name it to Force. Then Create > Parameter > New Customer Parameter. Set the default value to 7. And the ranges between 4 and 30. Also add the name "height". ![]() Now in the exlorer you got a "c" icon where the custom parameter set can be found. ![]() Now go back to the expression editor of the "Y" position of our soccer ball. abs(sin( Fc * 4 ) * SoccerBall.Force.height ). We replace the 7 with the custom parameter. Apply the expression and click play with loop. Now in the explorer select the Custom parameter and play around with it. You can see that now you can control how heigh ball is jumping. Also check the graph of the expression editor. Now the ball is jumping pretty slow and might not look like a heavy basketball or soccer ball, it seems to light. Now we add a second customer parameter so that we also have control over that. Select the "Force" in your explorer, then Create > Paramter > New Custom Paramter. Name it Speed and add the current value to 8, the mimimum to 1 and the maximum to 30. Change the forumla in the expression editor to abs(sin( Fc * SoccerBall.Force.speed ) * SoccerBall.Force.height ). ![]() Play again the animation and play around with the two custom sliders. ![]() So far the ball is not moving into any direction. So right click on the "z" under local transform > Pos. So now we will add an expression to SoccerBall.kine.local.posz. Add the formula Fc * 0.2 and apply it. Check the graph editor: ![]() The ball is constantly moving forwards. Now we will add a third custom parameter to control how much the ball is moving: Create > Paramter > New Custom Paramter, add the name "distance". Current value to 0.2, miminum to 0 and maximum to 3. Change the epxression formula to Fc * SoccerBall.Force.distance to apply the custom parameter. Now play the animation and drag the sliders to get the animation you want. Now you can also set key frames to make the animation you want, you could also set expressions for the rotation etc, there is way more you can do. |
|||