Generating ramps on a terrain using scripts

I’ve spend the whole day looking for a solution and the only thing that I got was some king of editor addon to draw ramps, so I’m asking for your help.

I’ve got a plain empty terrain and I’d like to draw 2 ramps on it, based on some parameters.
Everything must be done through scripts, since the ramps must be generated by user’s input.

The idea is to have a method like this one

private function GenerateRamps(upLength : float, upAngle : float, upHeight : float, distance: float, downLength: float, downAngle : float, downHeight: float)

that generates the two ramps, one that goes up while the other goes down, and puts them at a fixed distance (the distance parameter).

Angles are expressed in degrees while heights, lenghts and distance in meters.

Can you give some hint on this?
I really have no clue on where to start from.

With a terrain you are not going to get precisely what you want. The heights in a terrain are controlled by a heightmap. A heightmap is a regularly spaced grid of heights.

You specify the height at each pin, so any distances (ramp width, ramp distance, distances between ramps) will need to be rounded to fit on the heightmap grid. Take a look at the answer by @alucardj here:

http://answers.unity3d.com/questions/412624/how-can-i-make-my-algorithm-make-cloudy-heightmaps.html

He’s setting the heightmap using perlin noise, but this answer gives you the framework…how to get the height map, how to set values, how to apply those values.

For the heights of the ramp itself, you can just use Lerp() or calculate the linear progression by hand. While you did not ask for this, once you get the what you are doing working, it would be easy to apply a mathematical curve to the height values to produce ramps of different shapes.