SA-MP Forums Archive
SetCameraBehindPlayer coordinates - 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: SetCameraBehindPlayer coordinates (/showthread.php?tid=650154)



SetCameraBehindPlayer coordinates - ranme15 - 21.02.2018

Does anyone have a function to return SetCameraBehindPlayer's coordinates accurately?
I basically want to detect these coordinates without settings the camera behind the player.

Cheers


Re: SetCameraBehindPlayer coordinates - Davidmkd123 - 21.02.2018

Quote:
Originally Posted by ranme15
Посмотреть сообщение
Does anyone have a function to return SetCameraBehindPlayer's coordinates accurately?
I basically want to detect these coordinates without settings the camera behind the player.

Cheers
Just make a function like

Код:
new Float:Coords[3];
then take the coords by this float

Код:
GetPlayerCameraPos(playerid, Coords[0], Coords[1], Coords[2]);
Do that before the SetCameraBehindPlayer, and then do what you want with the Coords


Re: SetCameraBehindPlayer coordinates - ranme15 - 21.02.2018

Quote:
Originally Posted by Davidmkd123
Посмотреть сообщение
Just make a function like

Код:
new Float:Coords[3];
then take the coords by this float

Код:
GetPlayerCameraPos(playerid, Coords[0], Coords[1], Coords[2]);
Do that before the SetCameraBehindPlayer, and then do what you want with the Coords
If you don't know what im talking about, please avoid commenting.


Re: SetCameraBehindPlayer coordinates - NaS - 21.02.2018

He is almost right. Call SetCameraBehindPlayer, wait for syncing and then get the coords of the camera.

That will give you the exact coords of the camera when doing SetCameraBehindPlayer.
Then calculate the X/Y distance between player and that position and when setting the cam, get the facing angle and add this offset in the opposite direction (GetXYInFrontOfPlayer).