How to rotate towards input direction?

Thanks very much! This looks exactly like what I need.