SA-MP Forums Archive
GetPlayerCameraFrontVector Problems - 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: GetPlayerCameraFrontVector Problems (/showthread.php?tid=335627)



GetPlayerCameraFrontVector Problems - Jack_Leslie - 19.04.2012

I'm having problems with GetPlayerCameraFrontVector, from my understanding it's meant to get the position that the players camera is facing. Although it isn't doing that for me. Here's the code:

pawn Код:
tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /debug savecamera [single space comment]");
                return 1;
            }
            GetPlayerCameraFrontVector(playerid, pX, pY, pZ);
            GetPlayerCameraPos(playerid, pX2, pY2, pZ2);
            new File: file=fopen("debug.txt", io_append);
            format(string3, sizeof(string3), "SetPlayerCameraPos(playerid, %f, %f, %f);\r\nSetPlayerCameraLookAt(playerid, %f, %f, %f);  // %s \r\n\r\n", pX2, pY2, pZ2, pX, pY, pZ, tmp);
            fwrite(file, string3);
            fclose(file);
            SendClientMessage(playerid, COLOR_LIGHTRED, "DEBUG: You have saved your players Camera Vector Front LookAt.");
            return 1;
When I use the code it saves (SetPlayerCameraPos & SetPlayerCameraLookAt) it's not setting it to the right position. Instead it sets it to the players back vector, not the front.


Re: GetPlayerCameraFrontVector Problems - TheLazySloth - 19.04.2012

Use my SetCameraInFrontOfPlayer function.

You can find it here: https://sampforum.blast.hk/showthread.php?tid=326221.


Re: GetPlayerCameraFrontVector Problems - Jack_Leslie - 19.04.2012

Quote:
Originally Posted by TheLazySloth
Посмотреть сообщение
Use my SetCameraInFrontOfPlayer function.

You can find it here: https://sampforum.blast.hk/showthread.php?tid=326221.
That doesn't do what I want. I actually need to get the players camera position look at and then use that to set it later on.