Calculating facing angle cameras by offsetting -
[SF]OutLawZ - 06.01.2014
Hello, just a question I can't figure out,
How do I get a camera facing the player regardless what angle their facing?
Re: Calculating facing angle cameras by offsetting -
Threshold - 06.01.2014
Kind of confused what you're asking for here.
Do you want the camera to face the player head-on, no matter what way the player is looking?
Does the camera being set belong to the player themselves, or another player looking at this player?
Re: Calculating facing angle cameras by offsetting -
[SF]OutLawZ - 06.01.2014
Yes, the camera is to face the player head-on no matter what way their looking.
And no, the camera to face them self, not another player.
Re: Calculating facing angle cameras by offsetting -
Threshold - 06.01.2014
I don't know where you are using this function, so I put it in a command as an example. I named this command '/lookatmyself'.
ZCMD:
pawn Код:
CMD:lookatmyself(playerid, params[])
{
new Float:a, Float:x, Float:y, Float:z, Float:oldx, Float:oldy;
GetPlayerPos(playerid, oldx, oldy, z);
GetPlayerFacingAngle(playerid, a);
if(GetPlayerVehicleID(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
x = oldx + (4 * floatsin(-a, degrees));
y = oldy + (4 * floatcos(-a, degrees));
SetPlayerCameraPos(playerid, x, y, z);
SetPlayerCameraLookAt(playerid, oldx, oldy, z);
return 1;
}
STRCMP
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/lookatmyself", true) == 0)
{
new Float:a, Float:x, Float:y, Float:z, Float:oldx, Float:oldy;
GetPlayerPos(playerid, oldx, oldy, z);
GetPlayerFacingAngle(playerid, a);
if(GetPlayerVehicleID(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
x = oldx + (4 * floatsin(-a, degrees));
y = oldy + (4 * floatcos(-a, degrees));
SetPlayerCameraPos(playerid, x, y, z);
SetPlayerCameraLookAt(playerid, oldx, oldy, z);
return 1;
}
return 0;
}
Re: Calculating facing angle cameras by offsetting -
iZN - 06.01.2014
You can use this filterscript:
https://sampforum.blast.hk/showthread.php?tid=330879
OR
Alternatively you can use JernejL's map editor, there is a option for copy camera angle.
EDIT: Sorry if I get it wrong.
Re: Calculating facing angle cameras by offsetting -
[SF]OutLawZ - 06.01.2014
Quote:
Originally Posted by iZN
|
@ BenzoAMG, thank you alot! I'll test the code out.
@ iZN, I'm not after getting the camera angle coords but thanks anyways
It's a tricky one to explain