SA-MP Forums Archive
Set PlayerFacingAngle from GetPlayerCameraFrontVector - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Set PlayerFacingAngle from GetPlayerCameraFrontVector (/showthread.php?tid=274958)



Set PlayerFacingAngle from GetPlayerCameraFrontVector - KoczkaHUN - 07.08.2011

How can I set a player's facing angle using mouse vectors?

I need this to make a player face where (s)he looks with his/her mouse.


Re: Set PlayerFacingAngle from GetPlayerCameraFrontVector - RyDeR` - 07.08.2011

pawn Код:
new
    Float: vector_X,
    Float: vector_Y,
    Float: player_Angle
;
GetPlayerCameraFrontVector(playerid, vector_X, vector_Y, player_Angle);
player_Angle = atan2(vector_Y, vector_X) + 270.0;
I guess this is what you're looking for.