How to determine walking or falling when quit flying?

I want to make my movement mode flying when I play montage with root motion.

But how can I determine whether the character is falling or walking when the character quit flying ?