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
buildingRootGameObjectThe positioned building root GameObject.
roomSizeVector3The building's room dimensions.
targetWorldYfloatWorld Y to flatten to (typically foundation base).
paddingfloatExtra padding around the footprint in meters.
clearDetailsboolClear grass and detail layers in the flattened region.
blendDistancefloatDistance 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).