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(playeridobjectid)

{

    new 
Float:x1Float:y1Float:z1;

    new 
Float:x2Float:y2Float:z2;

    

    
GetPlayerPos(playeridx1y1z1);

    
GetObjectPos(objectidx2y2z2);

    

    new 
Float:angle atan2(y2 y1x2 x1) - 90.0;

    

    
SetPlayerFacingAngle(playeridangle);