WorldMap class in Visual style definition

Environment details for "Blocks" and "Heightfield" world type. The most important concept is a "Map", which is the array of Map elements. Internally, Maps have more elements than could be deduced from the user-supplied World.wrldsiz, as additional rows of element are added to provide smooth transitions to the flat surroundings.

Blocks: x/ysize=World.wrldsiz+4 rows of blocks (from which only 2+World.wrldsiz rows are placed within the world boundaries)

Smooth: x/ysize=World.wrldsiz+2 rows of vertices (creating World.wrldsiz+1 rows of triangles, everything within the world boundaries)

5 members:

integer xsize
integer

Map x size

integer ysize
integer

Map y size

function getHeight
returns float

Height

function getHeight(float x, float y)

Height at any 2d coordinate

function getMap
returns object

getMap

function getMap(integer x, integer y)

retrieve map cell object

function intersect
returns Vector

intersect

function intersect(Vector 3d_point, Vector 3d_direction, float range)

Calculate the intersection point between the world surface and the ray projected from "3d point" towards the given direction. 3D points are actually 3-elements Vector objects. The resulting vector contains the additional fourth element - the intersection point distance. The function returns null if there is no intersection.

See "standard_events.inc" file, which uses "intersect" for calculating the world coordinates corresponding to the user-clicked screen location.
Bugs: This function does not currently handle the heightfield environment correctly (works as if it was flat)


Global context>>Experiment definition>>Visual style definition