UnityEngine.TerrainData.GetInterpolatedHeight C# (CSharp) Method

GetInterpolatedHeight() private method

private GetInterpolatedHeight ( float x, float y ) : float
x float
y float
return float
        public extern float GetInterpolatedHeight(float x, float y);
        /// <summary>

Usage Example

コード例 #1
0
    /// <summary>
    /// </summary>
    /// <param name="terrainData"></param>
    /// <param name="position">Location in the XZ plane (not the XY plane!)</param>
    /// <param name="sphereRadius"></param>
    /// <returns></returns>
    private static Vector3 AdjustSpawnPositionForTerrainShape(TerrainData terrainData, Vector2 position, float sphereRadius)
    {
        var height = terrainData.GetInterpolatedHeight(position.x, position.y);
        var normal = terrainData.GetInterpolatedNormal(position.x, position.y);

        var offsetAlongNormal = normal * sphereRadius;
        var positionOnTerrain = new Vector3(position.x, height, position.y);
        return positionOnTerrain + offsetAlongNormal;
    }
All Usage Examples Of UnityEngine.TerrainData::GetInterpolatedHeight