ReplaceMaterial
For thread safety, this property is not safe to read in an unsynchronized thread.
ReplaceMaterial replaces terrain of a certain enum/Material within a datatype/Region3 with another material. Essentially, it is a find-and-replace operation on Terrain materials.
Constraints
When calling this method, the resolution parameter must be exactly 4. Additionally, the Region3 must be aligned to the terrain materials grid, i.e. the components of the Region3’s minimum and maximum points must be divisible by 4. Use Region3:ExpandToGrid to make a region compatible with this function.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
|
|
The region in which the replacement operation will occur |
||
|
|
The resolution at which the replacement operation will take place; at the moment this must be exactly 4. |
||
|
|
The old material that shall be replaced |
||
|
|
The new material |
Returns
| Return Type | Summary |
|---|---|
Code Samples
Terrain:ReplaceMaterial
This code sample demonstrates the usage of Terrain/ReplaceMaterial by replacing grass near the game origin with asphalt. It does this by constructing a datatype/Region3 using two datatype/Vector3s.