Looking at a point
#1

Hey guys, sorry again for disturbing you!
How can I set my players camera looking at a point? After I freeze my character, i want it to look at a point. I tried SetPlayerCameraLookAt, but it sets my camera at the default server connecting place(on the sky). SetPlayerFacingAngle sets only the rotation of the character. How should I solve this? Thank you!
Reply
#2

https://sampwiki.blast.hk/wiki/SetPlayerCameraLookAt

Did you use SetPlayerCameraPos?
Reply
#3

No I didnt. I want to point the camera to an object while its behind the player.
Reply
#4

Code:
stock SetPlayerLookAt(playerid, Float:X, Float:Y)
{
	new Float:Px, Float:Py, Float: Pa;
	GetPlayerPos(playerid, Px, Py, Pa);
	Pa = floatabs(atan((Y-Py)/(X-Px)));
	if (X <= Px && Y >= Py) Pa	 = floatsub(180, Pa);
	else if (X < Px && Y < Py) Pa = floatadd(Pa, 180);
	else if (X >= Px && Y <= Py) Pa = floatsub(360.0, Pa);
	Pa = floatsub(Pa, 90.0);
	if (Pa >= 360.0) Pa = floatsub(Pa, 360.0);
	SetPlayerFacingAngle(playerid, Pa);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)