Position camera infront of player
#1

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)