2010

Table Of Contents
To declare an int variable
Type the following in the Script Editor
int $testInt = 5;
print ($testInt/2);
The following is output to the Script Editor:
2
The int data type is used to store integer values. Integers are positive and
negative whole numbers. In programming, when an integer is divided
by another integer, the result is an integer, which is why the output here
is not 2.5 (2.5 is not an integer).
The print commands argument is enclosed in brackets. The print
command can only take one argument, so brackets are used to tell Maya
to evaluate the contents of the brackets before executing the command.
Brackets can also be nested in a method similar to mathematical
statements to determine the order of evaluation of statements.
In the steps that follow, you create a row of barrels by spacing the barrels
evenly. This creates barrels that are just touching, which ensures that there
are no intersections during the rigid body simulation
In the next section, well use the move command to position the duplicate
barrels, using the saved value of the diameter as an argument for the Z value
of the command.
Create a row of barrels
Here, well use the stored value of the diameter to space the duplicates of the
barrel. Variable values can be recalled at any time. Variables can be used as
values for arguments.
To duplicate the barrels
1 Select the barrel.
2 Duplicate the barrel by typing the following:
duplicate;
You have a duplicate of the first barrel, and it is the currently selected
object.
3 Align the duplicate barrel with the original by moving the duplicate in
Z by a value equal to its diameter by typing the following:
Create a row of barrels | 677