Get mouse angle [+REP]
#3

The wiki gives you an example:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp(cmdtext, "/test camera vector"))
    {
        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);
 
        return 1;
    }
 
    return 0;
}
Gets your crosshair's angle and creates an object.
Reply


Messages In This Thread
Get mouse angle [+REP] - by Lirbo - 21.07.2016, 21:50
Re: Get mouse angle [+REP] - by DTV - 21.07.2016, 23:53
Re: Get mouse angle [+REP] - by SickAttack - 22.07.2016, 00:18

Forum Jump:


Users browsing this thread: 2 Guest(s)