TerrainInfo
A class in Root.Township, the global namespace.
Singleton (SingletonBehaviour<TerrainInfo>.Instance) wrapping the world's Unity terrain: height, normal and steepness lookups in world coordinates, and the splat map. The server disables the terrain renderer.
- Listed in Global namespace: T to X
- Inherits or implements
SingletonBehaviour<TerrainInfo> - Derived types
TerrainInfo
Constructors
| Member | What it is |
|---|---|
TerrainInfo() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
const int SplatMapDivider | Constant 2. Probably the splat map's resolution divisor. |
5 private and internal fields
Properties
Methods
| Member | What it is |
|---|---|
float GetHeightAndNormalAtPosition(float x, float z, out Vector3 normal) | Terrain height (world y) and surface normal at a world x and z. |
float GetHeightAtPosition(TerrainAccess access, float x, float z) | Terrain height at a world x and z. The TerrainAccess overload reads from that segment and does not add the terrain's y offset. |
float GetHeightAtPosition(float x, float z) | Terrain height at a world x and z. The TerrainAccess overload reads from that segment and does not add the terrain's y offset. |
Vector3 GetNormalAtPosition(float x, float z) | Surface normal at a world x and z. |
TerrainAccess GetSegment(float x, float y, float width, float height, bool isHeight = true, bool isSplat = true) | Gets a TerrainAccess for a rectangle or bounds, clamped to the heightmap, with heights and splat if asked. |
TerrainAccess GetSegment(Bounds bounds, bool isHeight = true, bool isSplat = true) | Gets a TerrainAccess for a rectangle or bounds, clamped to the heightmap, with heights and splat if asked. |
float GetSteepnessAtPosition(float x, float z) | Slope in degrees at a world x and z. |
void InitializeEditor() | Editor: reads the terrain data without copying it. |
bool IsAbove(Vector3 point, float lenience = 0) | True if the point is above the terrain, allowing some lenience. |
protected override void Awake() | Copies the terrain data (except on Android) and hooks it to the terrain and its collider. |
1 private and internal method
Used in
Members of other types that take, return or hold a TerrainInfo: