Terrain

Objects that specialize in representing terrain and other collidable/walkable surfaces.

Functions

bool getTerrainHeight(Point2I position)

Gets the terrain height at the specified position.

Parameters:position – The world space point, minus the z (height) value. Formatted as (“x y”)
Returns:Returns the terrain height at the given point as an F32 value.
bool getTerrainHeight(F32 x, F32 y)

Gets the terrain height at the specified position.

Parameters:
  • x – The X coordinate in world space
  • y – The Y coordinate in world space
Returns:

Returns the terrain height at the given point as an F32 value.

bool getTerrainHeightBelowPosition(Point2I position)

Takes a world point and find the “highest” terrain underneath it.

Parameters:position – The world space point, minus the z (height) value. Formatted as (“x y”)
Returns:Returns the closest terrain height below the given point as an F32 value.
bool getTerrainHeightBelowPosition(F32 x, F32 y)

Takes a world point and find the “highest” terrain underneath it.

Parameters:
  • x – The X coordinate in world space
  • y – The Y coordinate in world space
Returns:

Returns the closest terrain height below the given point as an F32 value.

bool getTerrainUnderWorldPoint(Point3F position)

Gets the terrain block that is located under the given world point.

Parameters:position – The world space coordinate you wish to query at. Formatted as (“x y z”)
Returns:Returns the ID of the requested terrain block (0 if not found).
bool getTerrainUnderWorldPoint(F32 x, F32 y, F32 z)

Takes a world point and find the “highest” terrain underneath it.

Parameters:
  • x – The X coordinate in world space
  • y – The Y coordinate in world space
  • z – The Z coordinate in world space
Returns:

Returns the ID of the requested terrain block (0 if not found).

Variables

bool TerrainBlock::debugRender[static, inherited]

Triggers debug rendering of terrain cells.

float $pref::Terrain::detailScale

A global detail scale used to tweak the material detail distances.

float $pref::Terrain::lodScale

A global LOD scale used to tweak the default terrain screen error value.