In my case, in Godot 3.1 proposed solution wasn’t working (bunny started to glue himself to ceiling), so I changed fall function to:
func fall(delta):
if is_on_floor():
motion.y = 0
elif is_on_ceiling():
motion.y = GRAVITY * delta
else:
motion.y += GRAVITY * delta
and it works like a charm. Maybe it will help someone.