Terrain following for steep slopes

I aim to do terrain following, in AUTO mode on steep slopes (inclination = 60 deg). Assuming I have a sensor that can estimate this slope ( like a lidar or 3 single-point lidar), and vertical height above terrain, how can I do terrain following for such steep slopes.

Currently, the drone (simulator in gazebo) crashes into the terrain while trying to follow a slope of 60degrees.

My action plan is like this:

  1. Are there any parameters that can give me this kind of behavior?

2)Based on horizontal velocity, and estimated terrain angle, estimate the vertical velocity required to climb the terrain. (v_z=v_xy*tan (terrain angle)
3) Send this additional velocity as feedforward component in terrain shaping.

What is the best/easiest way to make changes to the codebase to do this?