05.08.2011, 20:34
How can I set the players camera to face them?
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));
}
//Example usage:
public OnPlayerSpawn(playerid)
{
SetPlayerCameraInFrontOfPlayer(playerid, 6, 2);
}
//You can also use Negative distance to set it back of the player.
|
As I know you might be bullshitting, I'll explain. Simply set the floats according to your positions. Easy eh'?
|
|
Are you looking for this? I already made it once..
pawn Код:
pawn Код:
|
|
Are you looking for this? I already made it once..
pawn Код:
pawn Код:
|
if(newkeys == KEY_LEFT)