docs.unity3d.com
    Show / Hide Table of Contents

    Class OptimizeHeightRange

    Exposes functions for making the best available use of the heightmap range on a given terrain

    Inheritance
    Object
    OptimizeHeightRange
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEditor.TerrainTools
    Syntax
    public static class OptimizeHeightRange

    Methods

    GetTerrainHeightRange(out Single, out Single, TerrainData[])

    Returns the minimum and maximum world height values for . The results are passed as out parameters.

    Declaration
    public static void GetTerrainHeightRange(out float minHeight, out float maxHeight, params TerrainData[] terrainDatas)
    Parameters
    Type Name Description
    Single minHeight

    float (will be reset)

    Single maxHeight

    float (will be reset)

    TerrainData[] terrainDatas

    One or more Terrain object

    OptimizeSelectedTerrains(Single, Single)

    Performs RemapTerrainHeights on the currently selected Terrain with a target efficiency of 95%

    Declaration
    public static void OptimizeSelectedTerrains(float padBottom = 0.025F, float padTop = 0.025F)
    Parameters
    Type Name Description
    Single padBottom

    Padding added below the height range; 0 - 1, relative the total height.

    Single padTop

    Padding added above the height range; 0 - 1, relative the total height.

    RemapSelectedTerrains(Int32, Int32)

    Remap selected terrain objects to use the specified height range.

    Unlike OptimizeSelectedTerrains this can be applied to multiple objects

    Declaration
    public static void RemapSelectedTerrains(int minY, int maxY)
    Parameters
    Type Name Description
    Int32 minY

    The lower world-space bound of the intended height range

    Int32 maxY

    The upper world-space bound of the intended height range

    RemapTerrainHeights(Terrain, Int32, Int32)

    Remap the heightmap pixels in a given Terrain so they completely fill a user-supplied range of heightmap values while preserving their current world positions. Heights outside the supplied range will be truncated to fit.

    Declaration
    public static void RemapTerrainHeights(Terrain targetTerrain, int heightMapMin, int heightMapMax)
    Parameters
    Type Name Description
    Terrain targetTerrain

    Terrain object to edit

    Int32 heightMapMin

    The world Y coordinate of the new lower bound of the the target terrain

    Int32 heightMapMax

    The world Y coordinate of the new upper bound of the the target terrain

    Back to top
    Copyright © 2023 Unity Technologies
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on Friday, November 3, 2023