SA-MP Forums Archive
Angle from postion to another - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Angle from postion to another (/showthread.php?tid=541498)



Angle from postion to another - MrJunkiTM - 12.10.2014

Hello,

iґm searching a code to get the angle from a position to antoher postion. For example, iґm standing in front of the LSPD and will look at the LSPD building. So i will get the angle to look on the LSPD building by the 2 positions.


Re: Angle from postion to another - Rudy_ - 12.10.2014

https://sampwiki.blast.hk/wiki/GetPlayerFacingAngle


Re: Angle from postion to another - MrJunkiTM - 13.10.2014

Thanks Rudy_, but i need a code to get angle by 2 postions


Re: Angle from postion to another - Rudy_ - 13.10.2014

I don't understand? What do you mean ' by 2 positions' ?


AW: Angle from postion to another - Nero_3D - 13.10.2014

That should be enough

pawn Код:
new Float: Angle = -atan2(TARGET_X - PLAYER_X, TARGET_Y - PLAYER_Y);
SetPlayerFacingAngle(playerid, Angle);



Re: Angle from postion to another - MrJunkiTM - 15.10.2014

Very nice, it works.

Thank you Nero_3D