open.mp forum
[Pawn] [Solved] Set player facing angle to the object - Printable Version

+- open.mp forum (https://forum.open.mp)
+-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
+--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
+--- Thread: [Pawn] [Solved] Set player facing angle to the object (/showthread.php?tid=2072)



[Solved] Set player facing angle to the object - Radical - 2021-06-01

Is there a function to set player facing angle to?object?





EDIT: https://www.burgershot.gg/showthread.php?tid=2072&pid=11395#pid11395


RE: Set player facing angle to the object - Pinch - 2021-06-01

get object's position and set player's camera to look at it? you can try that


RE: Set player facing angle to the object - Y_Less - 2021-06-03

Yes, SetPlayerFacingAngle.


RE: Set player facing angle to the object - Radical - 2021-06-03

I mean something else..

Never mind.


RE: Set player facing angle to the object - Schoenherr - 2021-06-05

Are you looking for something like this: https://sampwiki.blast.hk/wiki/SetPlayerCameraLookAt



Update: I misread what you were looking to do.


RE: Set player facing angle to the object - Leonardo - 2021-06-05

PHP Code:
stock SetPlayerFacingAngleToObject(playerid, objectid) { new Float:x1, Float:y1, Float:z1; new Float:x2, Float:y2, Float:z2; GetPlayerPos(playerid, x1, y1, z1); GetObjectPos(objectid, x2, y2, z2); new Float:angle = atan2(y2 - y1, x2 - x1) - 90.0; SetPlayerFacingAngle(playerid, angle); }