SA-MP Forums Archive
[HELP] Camera Look At - 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: [HELP] Camera Look At (/showthread.php?tid=515479)



[HELP] Camera Look At - vannesenn - 26.05.2014

Hi guys,
How I can get coords of camera lookat? I found code for get coords of camera pos, but I didn't found code for lookat pos. Thanks



Re: [HELP] Camera Look At - NaClchemistryK - 26.05.2014

good questuon. I've also been having problems with this, and left the camera lookat to random xyz rotations.
Waiting for a nice reply..


Re: [HELP] Camera Look At - JeaSon - 26.05.2014

same with /save or /rs


Re: [HELP] Camera Look At - Adityz - 26.05.2014

The Co-ordinates of 'SetCameraLookAt' should be the same as SetPlayerPos' Co-ordinates as it is supposed to look at the position where the player is standing.

Here's an example -

Firstly, set the player's pos. to your desired Co-ordinates -
pawn Код:
SetPlayerPos(playerid,-2724.392,988.204,54.460); // Just An Example
Then Set The Camera's Pos. by changing the X,Y and Zs of SetPlayerPos' Coordiantes by some meters.
pawn Код:
SetPlayerCameraPos(playerid,-2726.348,992.213,55.236);
Then Make The Camera Face the Player, By doing this -
pawn Код:
SetPlayerCameraLookAt(playerid,-2724.392,988.204,54.460); // Note that, its co-ords. are exactly the same as setplayerpos' co-ords.
Then set the player's facing angle according to your wish -
pawn Код:
SetPlayerFacingAngle(playerid,0); // I've used Zero as an example cuz i don't want my player to change his facing angle.
And There you have it. The Whole code -

pawn Код:
SetPlayerCameraPos(playerid,-2726.348,992.213,55.236);
SetPlayerCameraLookAt(playerid,-2724.392,988.204,54.460);
SetPlayerPos(playerid,-2724.392,988.204,54.460);
SetPlayerFacingAngle(playerid,0);



Re: [HELP] Camera Look At - NaClchemistryK - 26.05.2014

hey, wait.... could it be that the setcameralookat doesn't have anything to do with xyz rotations, but the position it is supposed to look at? if that's the case, then it is the first time that I understood this shit with camera lookat... fak, i am such an idiot.


AW: [HELP] Camera Look At - Macronix - 26.05.2014

Yes, the LookAt is the position, like it's name is saying, where the "camera" is "looking at" !


Re: [HELP] Camera Look At - NaClchemistryK - 26.05.2014

I map too much with mta, so I like rotations more than positions xD cause I rotate a lot.
thanks anyways


Re: [HELP] Camera Look At - vannesenn - 26.05.2014

Thanks, I'll make like you said.

EDIT:

I found a solution


Код:
	InterpolateCameraPos(playerid, Spawn[spawn_id][sCamPos1X], Spawn[spawn_id][sCamPos1Y], Spawn[spawn_id][sCamPos1Z], Spawn[spawn_id][sCamPos2X], Spawn[spawn_id][sCamPos2Y], Spawn[spawn_id][sCamPos2Z], Spawn[spawn_id][sCamTimer], CAMERA_MOVE);
	InterpolateCameraLookAt(playerid, Spawn[spawn_id][sCamLAPos1X], Spawn[spawn_id][sCamLAPos1Y], Spawn[spawn_id][sCamLAPos1Z], Spawn[spawn_id][sPosX], Spawn[spawn_id][sPosY], Spawn[spawn_id][sPosZ] + 0.60, Spawn[spawn_id][sCamTimer], CAMERA_MOVE);
Quote:

Spawn[spawn_id][sPosX], Spawn[spawn_id][sPosY], Spawn[spawn_id][sPosZ] + 0.60
With this code, camera will come direct behind player )

Thanks you, lock