Getting a players aiming vector
#1

Last night I was working on something and it turned out to be useful in another way so I made this filterscript.

https://sampforum.blast.hk/showthread.php?tid=463490

There is a problem however with it, that is trying to compensate for where the player is aiming I do have it working fairly close but by no means is it 100 percent accurate.

The main problem lies here.

pawn Code:
// Compensate (This is not perfect yet any ideas anyone?)
    if(weapon != 34 && weapon != 35 && weapon != 36)
    {
        new Float:FacingA;
        GetPlayerFacingAngle(playerid, FacingA);
        FacingA -= 90.0;
        if(FacingA < 0.0) FacingA += 360.0;
        else if(FacingA > 360.0) FacingA -= 360.0;

        fP[0] = (fP[0] + 0.6 * floatsin(-FacingA,degrees));
        fP[2] += 1.2;
    }
It works fine for sniper, and RPGS since the aiming offset is the center of the screen, the problem happens with other weapons even though it is reasonably accurate I would like to improve that accuracy.

So, any ideas of calculating the correct offsets remember were using, the following code to get the vector this is where the compensation needs to be adjusted for.

pawn Code:
GetPlayerCameraPos(playerid, fP[0], fP[1], fP[2]);
    GetPlayerCameraFrontVector(playerid, fV[0], fV[1], fV[2]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)