Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CAngle CVector::ToAngle() const // Thanks Spacetech
- {
- double yaw, pitch;
- if(this->Y == 0 && this->X == 0)
- {
- yaw = 0;
- pitch = this->Z > 0 ? 270 : 90;
- }
- else
- {
- yaw = (atan2(this->Y, this->X) * 180.0 / 3.14159263538979323);
- if(yaw < 0)
- yaw += 360;
- pitch = (atan2(-this->Z, this->Length2D()) * 180.0 / 3.14159265358979323);
- if(pitch < 0)
- pitch += 360;
- }
- return CAngle(pitch, yaw, 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement