24.10.2010, 22:29
So i've got this function by: SilentHuntR
It check's if player is looking at a point, i want to return the player looking point.
The x, y, z of the point on which the player is looking at.
Could somebody help me do that? Please? Thank you.
pawn Код:
stock IsPlayerLookingAtPoint(playerid,Float:X,Float:Y,Float:Z)
{
new Float:_IPLAP[13];
GetPlayerPos(playerid,_IPLAP[0],_IPLAP[1],_IPLAP[2]);
GetPlayerCameraUpVector(playerid,_IPLAP[3],_IPLAP[4],_IPLAP[5]);
_IPLAP[0]+=_IPLAP[3];
_IPLAP[1]+=_IPLAP[4];
_IPLAP[2]+=_IPLAP[5];
GetPlayerCameraFrontVector(playerid,_IPLAP[6],_IPLAP[7],_IPLAP[8]);
GetPlayerPos(playerid2,_IPLAP[9],_IPLAP[10],_IPLAP[11]);
_IPLAP[12]=floatsqroot( ((X-_IPLAP[0])*(X-_IPLAP[0])) + ((Y-_IPLAP[1])*(Y-_IPLAP[1])) + ((Z-_IPLAP[2])*(Z-_IPLAP[2])) );
_IPLAP[0]=_IPLAP[6]*_IPLAP[12]+_IPLAP[0];
_IPLAP[1]=_IPLAP[7]*_IPLAP[12]+_IPLAP[1];
_IPLAP[2]=_IPLAP[8]*_IPLAP[12]+_IPLAP[2];
if( (_IPLAP[0]>(X-0.25)) && (_IPLAP[0]<(X+0.25)) && (_IPLAP[1]>(Y-0.25)) && (_IPLAP[1]<(Y+0.25)) && (_IPLAP[2]>(Z)) && (_IPLAP[2]<(Z+2.0)) ) return 1;
return 0;
}
The x, y, z of the point on which the player is looking at.
Could somebody help me do that? Please? Thank you.
![Smiley](images/smilies/smile.png)