Earth & Map API

advanced scripting

World Map Strategy Kit · Scripting Support (C#)

Class: WMSK (namespace WorldMapStrategyKit). Access via WMSK.instance.

Earth API

Methods and properties on the WMSK component for Earth visuals, water, altitude sampling and horizontal wrap. Coordinate conversion and great-circle distance live in the static Conversion API.

Earth Style

enum EARTH_STYLE

Available Earth styles: Natural, Alternate1/2/3, SolidColor, NaturalHighRes, NaturalHighRes16K, NaturalScenic, NaturalScenic8K, NaturalScenic16K, NaturalScenicPlus, NaturalScenicPlusAlternate1, NaturalScenicPlus16K, Texture, Custom.

bool showEarth

Toggles Earth mesh visibility.

EARTH_STYLE earthStyle

Earth map style. Setting this value rebuilds Earth's material.

bool blurOnZoom

Enables bilinear blur on the Earth texture as the camera zooms in (default true).

Color earthColor

Earth tint color. Used by the SolidColor style and as a multiplier for Texture style.

Material earthMaterial { get; }

Currently active Earth material. Read-only; use SetEarthTexture/SetEarthWaterMask or the style-specific properties to modify Earth's look.

void ResetEarthStyle()

Clears all Earth-style customization (custom texture, bump map, height map, water mask) and reapplies the current style.

void SetEarthTexture(Texture2D texture)

Replaces the Earth background texture. Forces a refresh even if the new texture instance equals the current one.

Bump & Height Mapping

bool earthBumpEnabled

Enables normal mapping on the Earth surface. Only the styles reported by EARTH_STYLE.supportsBumpMap() respect this flag.

float earthBumpAmount

Bump intensity multiplier (default 0.5).

Texture2D earthBumpMapTexture

Custom normal map. Leave null to use the built-in bump texture for the current style.

Custom Texture

Texture2D earthTexture

Custom Earth background texture. Setting this forces earthColor back to white so the texture renders unmodified.

Vector2 earthTextureScale

Tiling of earthTexture (default (1, 1)).

Vector2 earthTextureOffset

UV offset applied to earthTexture.

Water (Scenic Plus styles)

bool showWater

Toggles water rendering in scenic styles.

Texture2D scenicWaterMask

Water mask used by Scenic Plus styles and by the pathfinding system to identify water cells. Defaults to the built-in WMSK/Textures/EarthScenicPlusMap8k.

void SetEarthWaterMask(Texture2D texture)

Replaces the water mask, forcing a refresh even if the new texture instance equals the current one.

Color waterColor

Base water color used by the Scenic Plus styles (default RGB 0,106,148).

float waterLevel

Water level for the Scenic Plus styles (default 0.1). Affects coastline rendering and pathfinding grid alpha.

float waterFoamThreshold

Foam threshold for the Scenic Plus styles. Lower values produce more foam (default 0.1).

float waterFoamIntensity

Foam intensity multiplier (default 30).

Map Properties

bool wrapHorizontally

Allows the camera to scroll across the horizontal edges of the map (infinite wrap). Lives on the WMSK component (defined in WMSKInteraction) and is included here for convenience.

Sampling the Map Surface

bool ContainsWater(Vector2 position)

Returns true if the given map position is on water. Reads the pathfinding water mask.

bool ContainsWater(Vector2 position, float boxSize, out Vector2 waterPosition)

Returns true if any point inside the box centered at position with side boxSize (map units) contains water; waterPosition receives the first match.

float GetAltitude(Vector2 position)

Returns the heightmap value at a given map position (normalized 0-1 range). Used internally by viewport elevation; returns 0 if elevation data has not been loaded.

EARTH_STYLE Extensions

Extension methods on EARTH_STYLE exposed by the static EarthStyleExtensions class.

bool isScenicPlus(this EARTH_STYLE earthStyle)

Returns true for the Scenic Plus styles (NaturalScenicPlus, NaturalScenicPlusAlternate1, NaturalScenicPlus16K).

int numTextures(this EARTH_STYLE earthStyle)

Number of texture slices used by the style (4 for the 16K styles, 1 otherwise).

bool supportsBumpMap(this EARTH_STYLE earthStyle)

Returns true when the style honors earthBumpEnabled/earthBumpMapTexture.

Looking for coordinate conversion or great-circle distance? See the Conversion API for the static Conversion class (GetLocalPositionFromLatLon, GetLatLonFromLocalPosition, Distance, tile helpers, etc.).
Was this page helpful?