How can is auto rotate to floor angle

This is an example of what i’m trying to do
going up hill is fine but going Right Left or Down the ramp does what the right side shows

trying to get the left hand side result