SA-MP Forums Archive
Camera behind player coords - 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: Camera behind player coords (/showthread.php?tid=341974)



Camera behind player coords - zgintasz - 12.05.2012

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!


Re: Camera behind player coords - zgintasz - 12.05.2012

Bump.


Re: Camera behind player coords - MP2 - 12.05.2012

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));
}



Re: Camera behind player coords - zgintasz - 13.05.2012

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.


Re: Camera behind player coords - zgintasz - 14.05.2012

Bump...