Determine the point you're looking at
#2

not sure:
pawn Код:
stock IsPlayerLookingAtPoint(playerid,Float:X,Float:Y,Float:Z,Float:Distance,RadiosToPoint)
{
    new Float:CX,Float:CY,Float:CZ,Float:FX,Float:FY,Float:FZ;
    new Float:PX,Float:PY,Float:PZ,Float:D;
    if(IsPlayerInRangeOfPoint(playerid,Distance,X ,Y ,Z))
    {
        GetPlayerCameraPos(playerid,CX,CY,CZ);
        GetPlayerCameraFrontVector(playerid, FX, FY, FZ);
        PX = FX*D+CX;
        PY = FY*D+CY;
        PZ = FZ*D+CZ;
        D = floatsqroot(((PX - X) * (PX - X)) + ((PY - Y) * (PY - Y)) + ((PZ - Z) * (PZ - Z)));
        if(D < RadiosToPoint)
        {
            return 1;
        }
    }
    return 0;
}
and then use at the command:
pawn Код:
new Float:x,Float:y,Float:z;
if(IsPlayerLookingAtPoint(Float:x,Float:y,Float:z,etc);
MoveObject(model,Float:x,Float:y,Float:Z);
not sure if it will work
it's just a sort out of how you would implement it
Reply


Messages In This Thread
Determine the point you're looking at - by Padarom - 12.05.2012, 18:19
Re: Determine the point you're looking at - by vassilis - 12.05.2012, 18:49

Forum Jump:


Users browsing this thread: 2 Guest(s)