SetPlayerCameraPos/LookAt - 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: SetPlayerCameraPos/LookAt (
/showthread.php?tid=272675)
SetPlayerCameraPos/LookAt -
Riddick94 - 29.07.2011
Hey.. um.. i know something about PAWN Language i working in this a lot of time (from 0.2.1) but with intervals. Something i know about this language (i think) but i never worked out SetPlayerCameraPos and LookAt..
I need someone who can make me a Camera look at the player from the front and some distance.. if someone make this please give me a screenshot and i'll tell you is it okey..
I feel ashamed..
Re: SetPlayerCameraPos/LookAt -
iPLEOMAX - 29.07.2011
I didn't understand you fully, but try this:
pawn Код:
stock SetPlayerCameraInFrontOfPlayer(playerid, Float:distance, Float:heightoffset) // iPLEOMAX
{
new Float:P[3];
GetPlayerPos(playerid, P[0], P[1], P[2]);
SetPlayerCameraLookAt(playerid, P[0], P[1], P[2]);
GetXYInFrontOfPlayer(playerid, P[0], P[1], distance);
SetPlayerCameraPos(playerid, P[0], P[1], P[2]+heightoffset);
}
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{ // Created by ******
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));
}
pawn Код:
//Example usage:
public OnPlayerSpawn(playerid)
{
SetPlayerCameraInFrontOfPlayer(playerid, 6, 2);
}
Re: SetPlayerCameraPos/LookAt -
Riddick94 - 29.07.2011
Thank you a lot! it is also possible from behind a player?
Quote:
I didn't understand you fully
|
What did you think? my English sucks i'm from Poland : D
Re: SetPlayerCameraPos/LookAt -
iPLEOMAX - 29.07.2011
Use distance as negative:
pawn Код:
SetPlayerCameraInFrontOfPlayer(playerid, -6, 2);
(Thanks to ****** for this)
Enjoy!
Re: SetPlayerCameraPos/LookAt -
Riddick94 - 29.07.2011
Thank you very, very, very much! : ) And to ****** too.. i using his includes : >