Godot 3 : move and slide only allow sliding up a slope lower than 40 degree

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By manusiatidakbiasa
:warning: Old Version Published before Godot 3 was released.

How can I make it so that if I do

move_and_slide(Vector3(0,0,-1))

And it hit a slope it will

Walk up the slope if angle is under 40

And walk sideways if slope angle is more than 40

Collision shape is a capsule