Trying to recover function code:
QAngles = vecDir.ToEulerAngles ( &vecUp ); https://developer.valvesoftware.com/wiki/QAngle vecDir and vecUp vectors.
vecUp can be 0
QAngles = vecDir.ToEulerAngles ( ); Can you tell me?
I found it on the Internet, but I don't know where to get w or r .
void Quaternion::ToEulerAngles(Vector3D & v) const { float sqw = w * w; float sqx = x * x; float sqy = y * y; float sqz = z * z; float unit = sqx + sqy + sqz + sqw; // if normalised is one, otherwise is correction factor float test = x * y + z * w; if (test > 0.499f * unit) // singularity at north pole { vy = 2.0f * atan2f(x, w); vz = FLOAT_PI / 2.0f; vx = 0.0f; return; } if (test < -0.499f * unit) // singularity at south pole { vy = -2.0f * atan2f(x, w); vz = -FLOAT_PI / 2.0f; vx = 0; return; } vy = atan2f(2.0f * y * w - 2.0f * x * z, sqx - sqy - sqz + sqw); vz = asinf(2.0f * test / unit); vx = atan2f(2.0f * x * w - 2.0f * y * z, -sqx + sqy - sqz + sqw); return; } Vector3 Quaternion::toEulerAngles() const { float sqw = r * r; float sqx = x * x; float sqy = y * y; float sqz = z * z; Vector3 euler( atan2( 2.0f * (x * y + z * r), sqx - sqy - sqz + sqw), asin( -2.0f * (x * z - y * r)), atan2( 2.0f * (y * z + x * r), -sqx - sqy + sqz + sqw)); return euler; }