GetWhereIsPlayerLook
#1

I have this:
pawn Код:
stock IsPlayerLookingAtPoint(playerid,Float:X,Float:Y,Float:Z,Float:ViewWidth,Float:ViewHeight)
{
    new Float:cx,Float:cy,Float:cz,Float:pa1,Float:pa2,Float:ca1,Float:ca2,Float:px,Float:py,Float:pz;
    GetPlayerCameraFrontVector(playerid,cx,cy,cz);
    GetPlayerPos(playerid,px,py,pz);
    pz+=2.0;
    cx=floatadd(cx,px);
    cy=floatadd(cy,py);
    cz=floatadd(cz,pz);
    pa1=atan2(X-px,Y-py);
    if(pa1>360)pa1=floatsub(pa1,360);
    if(pa1<0)pa1=floatadd(pa1,360);
    pa2=atan2(Y-py,Z-pz);
    if(pa2>360)pa2=floatsub(pa2,360);
    if(pa2<0)pa2=floatadd(pa2,360);
    ca1=atan2(cx-px,cy-py);
    if(ca1>360)ca1=floatsub(ca1,360);
    if(ca1<0)ca1=floatadd(ca1,360);
    ca2=atan2(cy-py,cz-pz);
    if(ca2>360)ca2=floatsub(ca2,360);
    if(ca2<0)ca2=floatadd(ca2,360);
    if((ca1>(pa1-ViewWidth))&&(ca1<(pa1+ViewWidth))&&(ca2>(pa2-ViewHeight))&&(ca2<(pa2+ViewHeight)))return 1;
    if((pa1-ViewWidth)<0)
    {
        ca1-=360.0;
        if((ca1>(pa1-ViewWidth))&&(ca1<(pa1+ViewWidth))&&(ca2>(pa2-ViewHeight))&&(ca2<(pa2+ViewHeight)))return 1;
    }
    if((pa1+ViewWidth)>360)
    {
        ca1+=360.0;
        if((ca1>(pa1-ViewWidth))&&(ca1<(pa1+ViewWidth))&&(ca2>(pa2-ViewHeight))&&(ca2<(pa2+ViewHeight)))return 1;
    }
    return 0;
}
from https://sampforum.blast.hk/showthread.php?tid=136868
but I need this plaese:
pawn Код:
GetWhereIsPlayerLook(playerid, Float:X,Float:Y,Float:Z,Float:ViewWidth,Float:ViewHeight)
Reply
#2

I'm sorry? I don't get it.. Do you ask for a function that do exactly the same like IsPlayerLookAtPoint, or you look for a function that set player to look at a point?
Reply
#3

I'd earlier think that he wants to see where the player is looking at... and returns the co-ordinates
This is to find out if the player is looking at a certain point...
Reply
#4

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
I'd earlier think that he wants to see where the player is looking at... and returns the co-ordinates
This is to find out if the player is looking at a certain point...
you get it so
can any one plaese do it plaese
Reply
#5

for who did not understand:
pawn Код:
new Float:X, Float:Z, Float:Z, Float:ViewWidth,Float:ViewHeight;
    GetWhereIsPlayerLook(playerid, Float:X, Float:Z, Float:Z, Float:ViewWidth,Float:ViewHeight); //this is the effect I need.
    if(IsPlayerLookingAtPoint(playerid,Float:X,Float:Y,Float:Z,Float:ViewWidth,Float:ViewHeight)
    (
        //Something Here
    }
that was what I mean
Reply
#6

Help help
Reply
#7

Meh, would be possible but not easy, you can only retrieve the line that 'travels' from the camera position to infinity. You'd need to use MapAndreas tot try to get an accurate ground position, not mentioning that 3D position would totally be awkward.

Best chance is to set a few points and use IsPlayerLookingAtPoint to try getting something accurate, this isn't easy.
Reply
#8

This can be helpful for you - http://forum.sa-mp.com/showpost.php?...6&postcount=14
It uses only distance instead of width and height though
Reply
#9

help help
Reply
#10

Quote:
Originally Posted by cca
Посмотреть сообщение
help help
plaese help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)