Pitch rotation problem with FindLookAtRotation function

Somehow I managed to get the right 0 to 360 angle values. Problem was in how FindLookAtRotation result behaves.

This is the working function for calculating the angle. Maybe it will help someone.