The particle instance options will window appear. Select an object and add it to the list. Lets tweak parameters (don't touch "cycle" related parameters). I advise you to turn the "Level Of Detail" to "BoundingBoxes" for a better workflow.
Lets take advantage of using particles... You could apply to the instanced objects complexes particle motion/effects such as using fields and collisions rigid solver (to reach the floor for example). Note that on creating a particle instance you can set many connection with particles attributes which affect the instanced objects.
How to bake particle instance? To do so, open the hypergraph, select your instance node, press Input and Output connections button. Then break the connection between the time node and the particle shape. Your spread instanced objects would keep this position in time
4 - Animation driven spreading:
We are going to "bake" animation. A kind of solid ghosting effect. First, animate one object the way you want (using any animation helpers you need, such as motion path). Then we will bake animation by simply duplicating the object at its position on the frames required. Also you would have non animated objects correctly placed. ! Last minute note : If you are using Maya 4.5 or higher, use the tool called Create Animation Snapshot.
Animation baked so as to spread the animated object. Example using motion path animation.
You can do it by hand by sliding the time slider and duplicate (CTRL+D) the object at this position in time. Or using this simple script (open the script editor and execute this script bellow to load this function). Select the the animated object(s) you want to bake animation, then is the command line (or in the script editor) type launch the function giving the arguments you want : bakeAnimation(3, 0, 25) for instance. This script does automatically what you would have done by hand... great!.
global proc bakeAnimation(int $step, int $startFrame, int $endFrame) {
if($step < 1) { error("bakeAnimation : the step argument must be at least higher than 1.\n"); }
Here is maybe one of the more interesting way to spread. You need simple melscripting knowledges (or other c-like scripting languages) . You must know some basics of melscripting... and especially the random function, duplicate function, transformations (move, rotate, scale) and the loop. Read the comments to understand the scripts steps.
Lets start code a simple object spreader. Simply duplicate several times the chosen object and place it randomly. The loop repeats several times this same action : returns random value for each axis, duplicate the object, place it with the random values. That is all!
global proc spreadObjects(
string $object,
int $duplicateNb,
float $Xmin,
float $Xmax,
float $Ymin,
float $Ymax,
float $Zmin,
float $Zmax
){
// Duplicate and place it randomly
string $duplicatedObject[] = `duplicate $object`;
move $randomX $randomY $randomZ $duplicatedObject;
}
print($object + " duplicated and randomly placed " + $duplicateNb + " times.\n");
}
To use this procedure/function, first execute it in the script editor or source the melscript file, then call the function from the command line. For instance, you can use this function by typing spreadObjects("myObject", 30, -10, 10, -10, 10, -10, 10). This tool we've just coded is very useful and easy to use.
spreadObjects() function used to place randomly 60 sheeps.
Next, you might want to randomize the scale of this range of objects just created. Lets use a such as melScript one more time. This script applys a loop on selected objects to random their scales.
global proc randomizeSelectedObjectsScale(float $minScale, float $maxScale) {
// Build the selected objects list
string $objectsList[] = `ls -sl`;
// Random scale of each object of the list
for ($object in $objectsList) {
// Get random value and scale object
float $randomScale = `rand $minScale $maxScale`;
scale $randomScale $randomScale $randomScale $object;
}
print("Random scale on " + size($objectsList) + " selected objects done.\n");
}
For instance, type randomizeSelectedObjectsScale(1, 5).
Sheep sizes have been a bit changed thank to the randomizeSelectedObjectsScale function.