Terrain Manager
Role
Handles the high-level terrain related tasks as it offers methods for other components to determine terrain area types and caches terrain height values to improve performance.
Setup
Essential manager component:
- Must be present in each map scene.
- Must be attached to a game object that is a child of the Game Manager object.
Inspector
General
Property | Description |
---|---|
Areas | Add an element for each Terrain Area Type you have in the map. |
Map Size | Approximation of the map size. For example, this value is used by NPC factions to determine the amount of territory it aims to control within the map. |
Height Caching
Height caching allows other components to directly inspect and get the height at any given point of the terrain. The terrain heights are cached when the game starts. This allows to gain performance as it avoids Raycasting operations every time a point's height in the terrain is requested.
Property | Description |
---|---|
Lower Left Corner | Defines the lower-left corner of the map as a boundary for caching height values. |
Upper Right Corner | Defines the upper-right corner of the map as a boundary for caching height values. |
Height Cache Distance | Starting the lower left corner of the map up, move by this distance value to cache height values each time until reaching the upper right corner of the map. |
Height Cache Sample Offset | When sampling terrain's height to cache, this offset is added to the Raycast source position which will head downwards to detect the terrain object and sample the height. |