Table of Contents

Class TerrainFlattener

Namespace
S1MAPI.Building.Structural
Assembly
S1MAPI_Mono.dll

Flattens terrain height and clears detail/grass under a building footprint. Only lowers terrain — never raises it — to avoid creating dirt walls. Works on both Mono and IL2CPP runtimes.

public static class TerrainFlattener
Inheritance
TerrainFlattener
Inherited Members

Methods

FlattenUnder(GameObject, Vector3, float, float, bool, float)

Flatten terrain under a building so the ground is level at the target height. Only lowers terrain that is above the target — never raises terrain. Optionally clears grass and detail layers in the flattened region.

public static bool FlattenUnder(GameObject buildingRoot, Vector3 roomSize, float targetWorldY, float padding = 0.5, bool clearDetails = true, float blendDistance = 0)

Parameters

buildingRoot GameObject

The positioned building root GameObject.

roomSize Vector3

The building's room dimensions.

targetWorldY float

World Y to flatten to (typically foundation base).

padding float

Extra padding around the footprint in meters.

clearDetails bool

Clear grass and detail layers in the flattened region.

blendDistance float

Distance in meters over which terrain smoothly transitions from the flattened height back to natural terrain. 0 = hard edge.

Returns

bool

True if terrain was found and flattened immediately; false if terrain wasn't available (a background retry has been queued automatically).