Advertisement
Guest User

CalcAngle

a guest
Mar 22nd, 2018
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. void CalculateAngle(const Vector &source, const Vector &destination, QAngle& angles)
  2. {
  3.         Vector delta = source - destination;
  4.         angles.pitch = static_cast< float >(asin(delta.z / delta.Length()) * M_RADPI);
  5.         angles.yaw = static_cast< float >(atan(delta.y / delta.x) * M_RADPI);
  6.         angles.roll = 0.0f;
  7.  
  8.         if (delta.x >= 0.0f)
  9.             angles.yaw += 180.0f;
  10.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement