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



GetPlayerCameraFrontVector - ScIrUsna - 20.05.2016

Hi,
Code:
new
            Float:fPX, Float:fPY, Float:fPZ,
            Float:fVX, Float:fVY, Float:fVZ,
            Float:object_x, Float:object_y, Float:object_z;
 
        // Change me to change the scale you want. A larger scale increases the distance from the camera.
        // A negative scale will inverse the vectors and make them face in the opposite direction.
        const
            Float:fScale = 5.0;
 
        GetPlayerCameraPos(playerid, fPX, fPY, fPZ);
        GetPlayerCameraFrontVector(playerid, fVX, fVY, fVZ);
 
        object_x = fPX + floatmul(fVX, fScale);
        object_y = fPY + floatmul(fVY, fScale);
        object_z = fPZ + floatmul(fVZ, fScale);
 
        CreateObject(345, object_x, object_y, object_z, 0.0, 0.0, 0.0);
This function is good, but it's possible to insert GetPlayerFacingAngle somehow? because i want get camera pos that angle what you are facing not how you face your camera with mouse


Re: GetPlayerCameraFrontVector - AbyssMorgan - 20.05.2016

maybe you can find something that will help you
3DTryg.inc:
https://sampforum.blast.hk/showthread.php?tid=591010