Thanks for choosing Interactive Terrain product.
Interactive Terrain is a set of helpers scripts used to enrich terrains by automatically adding colliders, audios, prefabs and many more based on user-painted layers. It saves a lot of time for developers and artists.
Because Interactive Terrain is a pure-Editor extension, the public scripts are running only in Editor mode, and will be empty shells at runtime. Moreover, all source code is provided, giving you the opportunity to customize this package.
The package Interactive Terrain is made of:
· ./Scripts: contains all public scripts to be added as components in your scene
· ./Prefabs: contains a customized version of FPSController
· ./Examples: an example scene made of assets from Standard unity package to demo this package
· ./Documentation: contains this guideline.
· ./Editor: internal scripts and resources.
Enjoy and don’t hesitate to contact us for support or feedback.
First step is to create different layers to your terrain. Layers will then be used by most of other scripts to generate objects and components inside the defined layers.
Choose your terrain, and add component to it. Choose “Interactive Terrain Layer”. You can add as many layers as you want to your terrain, simply drag and drop the Interactive Terrain Layer script multiple times to the terrain game object. Each script instance represents one layer.
Setting |
Description |
Usage |
Color of the layer |
Choosing different colors helps to easily identify and distinguish different layers |
|
|
Toggle visibility |
Select this option to show or not this layer. |
|
Toggle edit mode |
Select this option if you want to modify the layer. Only one layer at a time can be modified. If one terrain tool is selected, you will have this message:
In that case, click on Settings icon of the terrain to deactivate terrain’s brush:
After that, you should have following options:
|
Label |
Name of the layer |
Convenient name of this layer. This name will appear in dropdown lists of other component scripts when choosing the layer to use. |
Layer Transparency |
Transparency from 0 to 1 |
When multiple layers overlap, it is always useful to make them transparent to have better view of the layer area. |
Brush Size |
Brush size from 0 to 100 |
The brush is shown as a small blue circle like terrain’s brush. Use left click of your mouse to paint, and hold shift key + left click to erase.
|
The result would be:
This script can be used to cover an entire layer with audio sources to create ambient sounds like jungle, meadow, waves. Instead of manually creating dozens of audio sources in strategic points, this script automatically generates them with a statistic distribution to equally cover the desired area.
Attach this script to an empty game object. It will automatically attach an audio source component to it. Then setup the terrain object and its layer. The radius value will determine the distance between different child game objects to create. The game objects will be distributed across the layer with a distance comprised between radius and 2*radius.
To cover correctly the layer with the audio sound, modify the audio settings of the main audio source component accordingly. You can repeat as many times as you wish the generation of the game objects to try different audio source settings.
Each time the Generate Button is clicked, it will remove and recreate the child game objects with newly modified audio source values.
Setting |
Description |
Usage |
Terrain |
Terrain game object |
Choose the game object with the Terrain component. |
Layer |
Layer to work on |
A list of layers defined in the terrain game object is proposed. Choose which layer you want to use to generate audio game objects. |
Radius |
Radius |
The radius value will determine the distance between different sub-game objects to create. The game objects will be distributed across the layer with a distance comprised between radius and 2*radius |
Generate Audio Sources |
Button to generate game objects |
When clicking on this button, all children game objects are destroyed. Then the script creates as many game objects as necessary to cover the layer using density based on the radius. Each created child game object is composed of an audio source component with exact settings from audio source this parent game object. Each game object is also positioned at the terrain’s related height. |
The result would be:
This script can be used to cover an entire layer with a list of prefabs to create additional details to the terrain like rocks or barrels. Instead of manually creating one by one these game objects, this script automatically generates them with a statistic distribution to equally cover the desired area. With the prefabs list, you can control the density and the ratio between them.
Attach this script to an empty game object. Then setup the terrain object and its layer. The radius value will determine the distance between different child game objects to create. The game objects will be distributed across the layer with a distance comprised between radius and 2*radius.
Setting |
Description |
Usage |
Terrain |
Terrain game object |
Choose the game object with the Terrain component. |
Layer |
Layer to work on |
A list of layers defined in the terrain game object is proposed. Choose which layer you want to use to generate game objects. |
Radius |
Radius |
The radius value will determine the distance between different sub-game objects to create. The game objects will be distributed across the layer with a distance comprised between radius and 2*radius |
Prefabs List and Ratios |
List of prefabs |
|
Size |
Size of the list |
Change this integer value to add or remove prefabs to the list |
Ratio |
Ratio |
This ration between 0 and 100 determines the percentage of occurrence of this prefab in the list |
Prefab |
Prefab game object |
Game object to generate |
Total Ratios |
Readonly total |
This total of ratios MUST be equals to 100 to show the generate game objects button |
Position Variation |
Min – max x-y-z position |
Setup position variation ranges. Each generated game object will be applied a random variation of its position within the determined range. |
Rotation Variation |
Min – max x-y-z rotation |
Setup rotation variation ranges. Each generated game object will be applied a random variation of its rotation within the determined range. |
Scale Variation |
Min – max x-y-z scale |
Setup rotation variation ranges. Each generated game object will be applied a random variation of its scale within the determined range. |
Generate Game Objects |
Button to generate game objects |
When clicking on this button, all children game objects are destroyed. Then the script creates as many game objects as necessary to cover the layer using density based on the radius and at the terrain’s related height. Each game object will have a random rotation, position and scale within determined ranges. The ratio between generated game object is also respected according to setup. |
The result would be:
This script can be used to cover an entire layer with colliders to interact with player for example to change footstep audio. Instead of manually creating one by one colliders, this script automatically generates them with a statistic distribution to equally cover the desired area.
Attach this script to an empty game object. Then setup the terrain object and its layer. The radius value will determine the distance between different colliders attached. The colliders will be distributed across the layer with a distance comprised between radius and 2*radius.
Setting |
Description |
Usage |
Terrain |
Terrain game object |
Choose the game object with the Terrain component. |
Layer |
Layer to work on |
A list of layers defined in the terrain game object is proposed. Choose which layer you want to use to generate game objects. |
Radius |
Radius |
The radius value will determine the distance between different colliders to add. The colliders will be distributed across the layer with a distance comprised between radius and 2*radius |
Is Trigger |
Is Trigger option for generated colliders |
Determine if colliders attached will have Is Trigger option set. |
Material |
Material option for generated colliders |
Determine if colliders attached will have Material option set. |
Center |
Center deviation for generated colliders |
Determine which offset to apply to all generated colliders center position. |
Type |
Sphere or Box |
Determine what type of collider to create : Box Collider or Sphere Collider. Default is Sphere. |
Sphere Radius |
Radius option for generated colliders |
Determine the radius for each Sphere colliders |
Box Size |
Size option for generated colliders |
Determine the size for each Box colliders |
Generate Colliders |
Button to generate colliders |
When clicking on this button, all attached colliders components are destroyed. Then the script creates as many colliders as necessary to cover the layer using density based on the radius and at the terrain’s related height. |
The result would be:
This script uses Interactive Terrain Collider scripts to propose different step sounds to the FPScontroller. The asset FPSController in Prefabs folder is a slightly modified version of the standard FPSController proposed by Unity. Just drag and drop ./Prefabs/FPSController to your scene to immediately use Footstep Audio Manager script. Then add additional Interactive Terrain Colliders to Footstep Audio Manager.
Setting |
Description |
Usage |
Default sounds |
List of default audio steps |
When moving, the script FPSController will randomly play a sound from this list at each step. This list is the default list. |
Footstep Sounds List |
List of default footstep sounds |
For each interactive terrain colliders, we can play different step sounds. |
Colliders |
Interactive terrain colliders |
Drag and drop the interactive terrain colliders game object which will be used to trigger the new footstep sounds list. The generated colliders MUST have IsTrigger option checked as this script is based on it. |
Footsteps |
List of additional footstep sounds |
When the player is inside these colliders, the footstep sounds will be randomly played from this list. |
The result would be: