T u t o r i a l - Expressions - Sliders (Beginner)
Skill Level: Beginner.
Sliders can control just about everything in messiah, from motions and rotations to playing audio, loading and saving-- you name it! Lets take a look at the basic setup of a slider.
Create a slider and apply it to a sphere so it controls the Y movement. It's not an exciting mission, but they can't all be saving the world.
1) From the Load Items block on the File tab, load the object Whole_Object.lwo from the Objects/Tutorials folder.
2) Create a slider set by choosing Slider from the pulldown on the Add Items block, then pressing Add.
3) Go to the Command tab and click on New Variable on the Variables block.
4) Now for the fun (I don't get out much). Click on the xpos triangle slider tab on the slider set (it's the top channel). The triangle will turn yellow to show that it is active.
5) On the Expression block there's a field called Buffer, and to the right of the entry field is a small gray box. Right-click on the box and it will fill the entry field with [Slider:xpos]. This means that for this expression it will use the X position slider (xpos). The brackets ( [ and ] ) go around the item and its channel, with a colon ( : ) between them. You can type this in if you want, but it's much quicker to just press the button.
6) Click into the Exp entry field to the right of the [Slider:xpos] and type in *5 and press Enter. Here's why you did that: Because I control your mind and you do only what I say. Here's another reason: The sliders represent a value of 0 to 1, therefore if you don't put in a multiplier you'll only move the object a total of 1 unit. Putting the *5 in there tells the slider to multiply the position by 5. Naturally you can put in other values here, including +, -, /, or any formula. For our example, though, we'll stick with *5.
Note: When you're on the Command tab, the Item List becomes the Expressions List. Notice that the Expressions List now shows your expression.
7) What you've done so far is tell messiah to read the X slider channel and multiply that number by 5. But so far you haven't told it what to do with that information. So what you need to do now, is tell messiah what object you want to be affected by the slider and what aspect of its motion you want to control. The Add pulldown list lets you select what object you want to affect. Select Whole_Object and click on the [+] button. Now use the channel pulldown list to select what motion channel you want to control. Choose ypos.
Final expression in Expression List.
That's it! You've just created an expression and applied it to a slider to control an object! Just move the slider around and watch the ball go up and down. (Exciting, isn't it?) And of course, the slider can be keyframed.
Additional Steps: It's good to learn smart, clean setups right from the beginning, so let's fix this scene up a bit.
1) Go to the Animate tab. Double-click on the Slider in the Item List and rename it to Ball_Control.
2) Go to the Values block on the Setup tab and rename the first slider channel (xpos) to Ball_Y.
3) Now hide the slider channels you're not using. Right-click on the colored dots for the channels you're not using. They'll turn gray to show that they're not visible. As you can see, the sliders will disappear until you're left with just the Ball_Y channel. Click out of Setup now.
Each of these steps could have been taken during the initial setup, and usually that's a better time to do it, but I thought I'd make the basic setup as simple as possible, because I know I'd be lost if I was trying to learn this stuff.
Additional Information: For more information, take a look at these pages-- Sliders (General Info), Expressions (General Info), Functions (General Info-Functions), and Breaking Down Expressions (General Info-Functions)
|Converted from CHM to HTML with chm2web Pro 2.82 (unicode)|