[HELP] Camera Look At
#1

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
Reply
#2

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

same with /save or /rs
Reply
#4

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);
Reply
#5

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.
Reply
#6

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

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)