This site is a testing version, but all data is shared with the live forum.


Raised This Month: $12 Target: $400
 3% 

vecto_to_angle


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
padilha007
Senior Member
Join Date: Jul 2008
Old 03-05-2012 , 00:24   vecto_to_angle
Reply With Quote #1

I wanted to know the formula for Vector to angle. I thought the links below but I did not have a concrete answer.

Someone can show how it is without any interference from the engine?

http://forums.alliedmods.net/showthread.php?t=76102
__________________


Last edited by padilha007; 03-05-2012 at 07:49.
padilha007 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-05-2012 , 01:23   Re: vecto_to_angle
Reply With Quote #2

Quote:
Originally Posted by padilha007 View Post
I wanted to know the formula for Vector to angle. I thought the links below but I did not have a concrete answer.

If someone can show how it is without any interference from the engine I would appreciate

http://forums.alliedmods.net/showthread.php?t=76102
Is there a reason you don't just use the function?
__________________

Last edited by fysiks; 03-05-2012 at 01:31.
fysiks is offline
padilha007
Senior Member
Join Date: Jul 2008
Old 03-05-2012 , 07:48   Re: vecto_to_angle
Reply With Quote #3

just to learn
__________________

padilha007 is offline
Old 03-05-2012, 07:50
MiZic3k
This message has been deleted by Exolent[jNr]. Reason: Cross posting.
Old 03-05-2012, 07:51
MiZic3k
This message has been deleted by Exolent[jNr]. Reason: Cross posting.
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 03-05-2012 , 15:17   Re: vecto_to_angle
Reply With Quote #4

here:
PHP Code:
new Float:_pg_ftmp
#define _Vec3ToAngles(%1,%2) _pg_ftmp = floatsqroot(%1[0]*%1[0] + %1[1]*%1[1]);\
    
%2[1] = floatacos(%1[0]/_pg_ftmp1)*(1-2*_:(%1[1]<0));\
    %
2[0] =-floatatan(%1[2]/_pg_ftmp1);\
    %
2[2] = 0.0 
__________________
Impossible is Nothing
Sylwester is offline
padilha007
Senior Member
Join Date: Jul 2008
Old 03-05-2012 , 17:23   Re: vecto_to_angle
Reply With Quote #5

@ Sylwester

Thnx for your reply
__________________

padilha007 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-06-2012 , 00:36   Re: vecto_to_angle
Reply With Quote #6

Code:
void VectorAngles(const vec3_t forward, vec3_t angles) {

   float   tmp, yaw, pitch;

   if(forward[1] == 0 && 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;
}
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 06:39.


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