Wednesday, January 13, 2016

Crowd randomizer

This is a quick little script I wrote for a project I worked on.

We had a few cached variations of characters of different sizes and colors with different animations. We instanced these caches the number of times we needed to fill out our bleachers(in the script I called this group 'objects'). Then, we had cubes that had been instanced and placed on the bleachers to represent the characters positions (in the script I call this group 'placeholders'). This script places each character in the position of one of the cubes in a random order.

To run the script, copy the code below to the script editor and change the value of the variable 'num' on line 4, to the number of objects you want to randomize (the number of objects to reposition should match the number of placeholders). Then, highlight all the text and hit ctrl+ENTER to execute the code.