Raised This Month: $ Target: $400
 0% 

Vector to angles, angles to vector [Solved]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 01-24-2014 , 10:54   Re: Vector to angles, angles to vector
Reply With Quote #1

Quote:
Originally Posted by jimaway View Post
why the hell are you asking this here if its not for amxx
Because i want that formula is in pawn code.
This is my excuse.

Just leaving it here in case someone need it:
PHP Code:
void VectorAngles(const vec3_t forwardvec3_t angles) {

   
float   tmpyawpitch;

   if(
forward[1] == && forward[0] == 0) {

      
yaw 0;
      if(
forward[2] > 0) { pitch 90; }
      else { 
pitch 270; }
   }
   else {

      
yaw = (atan2(forward[1], forward[0]) * 180 M_PI);
      if(
yaw 0) { yaw += 360; }

      
tmp sqrt(forward[0]*forward[0] + forward[1]*forward[1]);
      
pitch = (atan2(forward[2], tmp) * 180 M_PI);
      if(
pitch 0) { pitch += 360; }
   }
   
angles[0] = pitch;
   
angles[1] = yaw;
   
angles[2] = 0;


Last edited by .Dare Devil.; 01-24-2014 at 18:33.
.Dare Devil. is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:04.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode