Created
April 12, 2017 14:00
-
-
Save jspillers/27368e1079235181a3dea8acd38a0e84 to your computer and use it in GitHub Desktop.
one method from a c# class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void FlattenVolume() { | |
float flattenToY = Mathf.Lerp(deformerCollider.bounds.min.y, deformerCollider.bounds.max.y, flattenTo); | |
float flattenHeight = Coord.WorldHeightToTerrainHeight(flattenToY, terrain); | |
foreach (Vertex v in this.localHeightMap.localHeightmapVertices) { | |
if (v.insideDeformerCollider || (!v.insideDeformerCollider && this.flattenArea)) { | |
if (v.areaZ < this.terrainArea.terrainHeights.GetLength(0) || v.areaX < this.terrainArea.terrainHeights.GetLength(1)) { | |
this.terrainArea.terrainHeights[v.areaZ, v.areaX] = flattenHeight; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment