• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Take the angle of a position
#6
(2021-02-26, 11:55 PM)Virsenas Wrote: https://www.burgershot.gg/showthread.php...3#pid10013



You will have to edit the function so you have to enter the x, y and z coordinates instead of playerid (faceplayerid).
I know the function was not created by you, but still ...
Wtf, is all this stuff done with floatsub, floatadd and such. None of that is needed as atan2 already takes into account the sign of both arguments in order to determine the quadrant.

This is all that's needed:
PHP Code:
PlayerFacePosition(playeridFloat:xFloat:y)
{
    new 
Float:pxFloat:pyFloat:pz;
    
GetPlayerPos(playeridpxpypz);

    new 
Float:angle atan2(pypx);
    
SetPlayerFacingAngle(playeridangle 90.0); 

The -90.0 is to account for the weird GTA angle orientation. The actual angle between the 2 points is without this subtraction.
Always keep in mind that a lot of people are active on this forum in their spare time.

They are sacrificing time they could easily spend on things they would rather do, to help you instead.

  Reply


Messages In This Thread
Take the angle of a position - by Marllun - 2021-02-26, 03:10 PM
RE: Take the angle of a position - by Freaksken - 2021-02-26, 04:31 PM
RE: Take the angle of a position - by arber - 2021-02-26, 07:35 PM
RE: Take the angle of a position - by Marllun - 2021-02-26, 11:29 PM
RE: Take the angle of a position - by Virsenas - 2021-02-26, 11:55 PM
RE: Take the angle of a position - by Freaksken - 2021-02-27, 12:25 PM

Forum Jump: