They said a good programmer is lazy. Well, I hope this is true because I was super lazy on the other day. I literally wrote a script in several hours instead of doing 10 minutes of work by putting prefabs together.
This sounds silly, right? Maybe it is, but I enjoyed working on this small script and trying to remember to the trigonometry from high-school. Let me introduce the weird and questionably useful result of my lazy-work: the Book Pile/Cluster Generator.
On the two screenshots below you can see, the very different result of a single click on a button.
So how did I end up to make something like this? Currently, we are working on the first update for the Dark Fantasy Kit. While Dotti is still modeling and texturing, my job is to test the models and create prefabs from it. We already added 100+ new prefabs, and there were multiple iterations, it’s quite a work. While I love doing this, it started to become too repetitive.
At the time I had to create a few book piles and clusters from the books she made, I just can’t start it. I decided to let rest the left side of my brain, and work with the right side, and the script was born.
How to use it?
- Download and import it to your project.
- Create a new prefab and add the script to it.
- Select the type from the general settings, and add your books to the list.
- Set the Book Parameters section. If you are using our books from PBR Alchemy Lab or from the Dark Fantasy Kit, you can leave it as it is.
- Tweak the settings for the right type.
- Click on the Generate button.
Pile Settings
- Book Count: the number of books in the pile.
- Rotation Random: determines how much rotation is applied to the books. 0 means zero rotation, the books will lay on each other in perfect order. 1 means the books are rotated very differently.
Cluster Settings
- Cluster Width: instead of giving the book count in case of a cluster you set the width of the book cluster.
- Slanted Random: how many books should be slanted.
- Slanted Max Angle: the maximum angle by with the books are slanted.
- Z Pos Random: determines the random offset applied to the book position z axis.
- Show Gizmo: for debuging purposes.
One thought to “Book Cluster Generator Script”