WorldFittedTerrainScript

WorldFittedTerrainScript

Creates and exposes a square heightmap terrain fitted within given world dimensions.
This does not do any visualizing of the heightMap. That needs to be done elsewhere.

Constructor

new WorldFittedTerrainScript()

Methods

addHeightData(heightMatrixopt, dimensionsopt)

Adds a block of height data from an image at given dimensions and stores the script in an array.

Parameters:
Name Type Attributes Description
heightMatrix Array <optional>

file to load height data from

dimensions Object <optional>

dimensions to fit the data within

displaceAxisDimensions(axPos, axMin, axMax, quadCount) → {Number}

Adjusts coordinates to from heightMap to fit the dimensions of raw displacement data.

Parameters:
Name Type Description
axPos Number
axMin Number
axMax Number
quadCount Number

getHeightDataForPosition(posopt) → {Object}

Returns the script relevant to a given position

Parameters:
Name Type Attributes Description
pos Vector3 <optional>

data, typically use entity transform

getTerrainHeightAt(pos) → {Number}

Looks through height data and returns the elevation of the ground at a given position

Parameters:
Name Type Description
pos Vector3

Position

getTerrainNormalAt(posopt) → {Vector3}

Returns the a normalized terrain normal for the provided position

Parameters:
Name Type Attributes Description
pos Vector3 <optional>

the position

returnToWorldDimensions(axPos, axMin, axMax, quadCount) → {Number}

Returns coordinates from raw displacement space to fit the dimensions of a registered heightMap.

Parameters:
Name Type Description
axPos Number
axMin Number
axMax Number
quadCount Number