SetPlayerCameraPos/LookAt
#1

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..
Reply
#2

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);
}
Reply
#3

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
Reply
#4

Use distance as negative:

pawn Код:
SetPlayerCameraInFrontOfPlayer(playerid, -6, 2);
(Thanks to ****** for this)

Enjoy!
Reply
#5

Thank you very, very, very much! : ) And to ****** too.. i using his includes : >
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)