Camera behind player coords
#1

Hi guys,

So, is it possible, to get camera coords which will return SetCameraBehindPlayer function if I know player position and angle? I think there is offset from player position... But I don't know, how to calculate it.

I tried this way(after using SetCameraBehindPlayer function), but I'm getting different results...
pawn Код:
new
    Float:zPos[ 3 ],
    Float:cPos[ 3 ],
    string[ 100 ]
;
GetPlayerPos( playerid, zPos[ 0 ], zPos[ 1 ], zPos[ 2 ] );
GetPlayerCameraPos( playerid, cPos[ 0 ], cPos[ 1 ], cPos[ 2 ] );
format( string, sizeof( string ), "%f, %f, %f", zPos[ 0 ] - cPos[ 0 ], zPos[ 1 ] - cPos[ 1 ], zPos[ 2 ] - cPos[ 2 ] );
SendClientMessage( playerid, 0xFF0000FF, string );
I need this, because I want to make something like SetCameraBehindPlayer( playerid, CAMERA_MOVE )(using InterpolateCameraPos)

If someone will help me to calculate, I will be very thankful ^^.

Thank you very much!
Reply
#2

Bump.
Reply
#3

This will help:

pawn Код:
GetXYBehindPlayer(playerid, &Float:q, &Float:w, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, q, w, a);
    GetPlayerFacingAngle(playerid, a);
    q += (distance * -floatsin(-a, degrees));
    w += (distance * -floatcos(-a, degrees));
}
Reply
#4

I think you don't understand me(or maybe I don't understand you)... I know player position, angle and I want to get camera coords, what will return function SetCameraBehindPlayer if I'll use it.
Reply
#5

Bump...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)