AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to find Angle of origin (https://forums.alliedmods.net/showthread.php?t=184081)

0920357689 04-30-2012 16:39

how to find Angle of origin
 
origin1[3]
origin2[3]

how to find origin2 on origin1 is what Angle?

Liverwiz 04-30-2012 16:46

Re: how to find Angle of origin
 
Float:angle = floatatan((origin1[1] - origin2[1]) / (origin1[2] - origin2[2]), DEGREES)

make sure to #include <float>

0920357689 04-30-2012 18:14

Re: how to find Angle of origin
 
is my bad
need add one angle on formula
Quote:

new Attack_Origin[3], Victim_Origin[3];
get_user_origin (attacker, Attack_Origin);
get_user_origin (victim, Victim_Origin);

new Float:Attack_FOrigin[3], Float:Victim_FOrigin[3];
IVecFVec (Attack_Origin, Attack_FOrigin);
IVecFVec (Victim_Origin, Victim_FOrigin);

new Float:angle = floatatan((Attack_FOrigin[1] - Victim_FOrigin[1]) / (Attack_FOrigin[2] - Victim_FOrigin[2]), degrees);
client_print(0 , print_chat , "%f",angle);

Liverwiz 04-30-2012 18:29

Re: how to find Angle of origin
 
Quote:

Originally Posted by 0920357689 (Post 1699568)
is my bad
need add one angle on formula

seems like you did way too much work there. You can typecast an int as a float. Example:
Code:

Float:num = float(origin[x])
hopefully you can deploy that concept accordingly......it'll save you a bit of finger work, and processing.

0920357689 04-30-2012 18:57

Re: how to find Angle of origin
 
1 Attachment(s)
Quote:

Originally Posted by Liverwiz (Post 1699584)
seems like you did way too much work there. You can typecast an int as a float. Example:
Code:

Float:num = float(origin[x])
hopefully you can deploy that concept accordingly......it'll save you a bit of finger work, and processing.

i need the Formula is....

<VeCo> 05-01-2012 12:43

Re: how to find Angle of origin
 
PHP Code:

new Float:angles[3]
entity_get_vector(attacker,EV_FL_angles,angles

Will return attacker's entity (player) angles.


All times are GMT -4. The time now is 07:47.

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