|
Exercise
12
|
||||||
|
Write a simple script WhatÕs going on? The getparam call is a general purpose command for accessing specific information about objects in our scene. The file params.html on your PiXELS3D CD describes all of the options available in detail. In this example we are using the -r.z option. This option will return, in degrees, the z component of the objectÕs rotation angle. The same value can be seen and altered using the Object Info palette. Our variable, zRot, is now equal to the z rotation angle of the handle object. That alone is pretty useless, but we can use this information to control other objects in the scene. First, letÕs modify the value a little. In the second line of our script, we use the expr command to mathematically alter our variable. We also use the set command to assign the altered value to a new variable, yPos. Notice how we must place a $ in front of our variable. Anytime a variable is used in an expression or command, it must be preceded by a $. In the third line, we introduce the setparam command. This command is the compliment of getparam. It is used to pass variables to objects in our scene. In this example we are using the -p.y option. This option will set the y position of a given object to our variable. Notice how the variable is preceded with a $. We also added an objectÕs name to the end of this command. This directs the value to the named object, as opposed to the object that this script belongs to. Set constraints |
||||||