SA-MP Forums Archive
Position camera infront of player - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Position camera infront of player (/showthread.php?tid=139566)



Position camera infront of player - MummyKillerSLO - 05.04.2010

Hi!

How to position camera in front of a player on class selection (note: I must have only player position)? Can I do this with sin and cos function ?


Re: Position camera infront of player - [MWR]Blood - 05.04.2010

There isn't a specific function, you should use SetPlayerCameraPos
https://sampwiki.blast.hk/wiki/SetPlayerCameraPos


Re: Position camera infront of player - Babul - 05.04.2010

maybe that few commands will help you - the Radius R is set too high at 10, 4 should do fine for the skin selecion if you want the camera close to the character.
Код:
	new Float:X,Float:Y,Float:Z,Float:A,Float:R=10;
	GetPlayerPos(playerid,X,Y,Z);
	GetPlayerFacingAngle(playerid,A);
	new Float:CX,Float:CY,Float:CZ;
	CX=X+(R*floatsin(-A,degrees));
	CY=Y+(R*floatcos(-A,degrees));
	CZ=Z+1;
	SetPlayerCameraPos(playerid,CX,CY,CZ);
	SetPlayerCameraLookAt(playerid,X,Y,Z);



Re: Position camera infront of player - [MWR]Blood - 05.04.2010

Quote:
Originally Posted by Babul
maybe that few commands will help you - the Radius R is set too high at 10, 4 should do fine for the skin selecion if you want the camera close to the character.
Код:
	new Float:X,Float:Y,Float:Z,Float:A,Float:R=10;
	GetPlayerPos(playerid,X,Y,Z);
	GetPlayerFacingAngle(playerid,A);
	new Float:CX,Float:CY,Float:CZ;
	CX=X+(R*floatsin(-A,degrees));
	CY=Y+(R*floatcos(-A,degrees));
	CZ=Z+1;
	SetPlayerCameraPos(playerid,CX,CY,CZ);
	SetPlayerCameraLookAt(playerid,X,Y,Z);
SetPlayerCameraPos is easier.