PlayerCameraPos - 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)
+--- Thread: PlayerCameraPos (
/showthread.php?tid=476340)
PlayerCameraPos -
Lajko1 - 17.11.2013
How can I set Camera Positing near player's foot, looking towards sky? I tried this (don't roll your eyes haha)
pawn Код:
if(strcmp(cmd, "/test", true) == 0)
{
new X,Y,Z;
GetPlayerPos(playerid, Float:X,Float:Y,Float:Z);
SetPlayerCameraPos(playerid,X,Y,0);
SetPlayerCameraLookAt(playerid, X,Y,Z+10);
return 1;
}
To be honest I didn't know what I did but when I tested it my samp was lagging and some strange effects was going on hahah... so how should I place camera near player foot looking up towards sky?
Re: PlayerCameraPos -
Lajko1 - 17.11.2013
Well now I tried to make object and attach it to player and attach camera to that object, but I can't make it so camera will look in front of player.. how can I make it?
pawn Код:
if(strcmp(cmd, "/test", true) == 0)
{
new Float:x, Float:y, Float:z;
GetPlayerCameraPos(playerid, Float:x, Float:y, Float:z);
new playerobject = CreateObject(playerid, 19300, 0.130999, 0.063999, 0.139000, 0.000000, 0.000000, 0.000000);
AttachObjectToPlayer(playerobject,playerid,0.130999, 0.063999, 0.139000, 0.000000, 0.000000, 0.000000);
SetPlayerCameraLookAt(playerid,x,y,z+10);
TogglePlayerControllable(playerid,0);
AttachCameraToPlayerObject(playerid, playerobject);
return 1;
}
Here is the code what I tried but Camera isn't looking in front of player :/
Re: PlayerCameraPos -
[D]ry[D]esert - 18.11.2013
Have you ever heared about
pawn Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, x, y, a);
GetPlayerFacingAngle(playerid, a);
if (GetPlayerVehicleID(playerid))
{
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
}
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
}
Re: PlayerCameraPos -
Lajko1 - 18.11.2013
Never :S
So what to put in than if I will use GetXYInFrontOfPlayer?
pawn Код:
SetPlayerCameraLookAt(playerid, what I need to put in here?);
Re: PlayerCameraPos -
Lajko1 - 18.11.2013
Bump
Re: PlayerCameraPos -
Lajko1 - 18.11.2013
C'mon what parameters should I put if I use GetXYInFrontOfPlayer or.. how to make that camera will be placed near player's head looking in front of him? :/