Image
Go back

Instance Objects


    code

With this script you can choose any number of objects and duplicate them with random values across a surface, to easily create a dense scene. It will also detect slopes, so for example, you may want to place boulders on flat ground, but have certain types of foliage growing up a cliff.

The way the script works is by creating an emitter on the selected object. The scene is moved forward one frame, and each particle is queried for it's speed. From this it calculates the angle of the slope, and any point below the set percentage will not be used.
The script will then read which objects you have previously stored, and will randomly choose from this list when placing at the location of the particles. This takes a while as each individual object is having a random scale and rotation calculated after placement.

I still plan on doing further work to this, such as the ability to bring up a list of objects, set ratios, and give each object a slight tilt based on the slope angle (so a tree on a cliff will point a little out and not straight up).

User Interface
Viewport Screenshot