Check if player is looking at the coordinate?
#1

Hello everyone, how do I make a calculation to check if the angle of the player is facing some coordinate?







@Sorry for the lousy english
Reply
#2

Click
Reply
#3

Might this code can help you:
PHP код:
IsActorInPlayerFacingAngle(playeridactoridFloat:max_angle 90.0bool:isdynamic DEFAULT_IS_DYNAMIC_PARAMETER)
{
    if(!
IsPlayerConnected(playerid) || !AP_IsValidActor(actorid))
        return 
0;
    new 
Float:ang,
        
Float:second_ang,
        
Float:result;
    
GetPlayerFacingAngle(playeridang);
    
#if USING_STREAMER
        
if(isdynamic)
            
GetDynamicActorFacingAngle(actoridsecond_ang);
        else
            
GetActorFacingAngle(actoridsecond_ang);
    
#else
        #pragma unused isdynamic
        
GetActorFacingAngle(actoridsecond_ang);
    
#endif
    
if(ang 180.0)
        
result 180.0 ang;
    else
        
result ang 180.0;
    
    if(
second_ang max_angle 360.0 || second_ang max_angle 0.0)
        return ((
360.0 max_angle <= result <= 360.0) || (0.0 <= result <= max_angle));
    else
        return (
second_ang max_angle <= result <= second_ang max_angle);

Taken from : https://github.com/Dayrion/actor_plu...nc#L1444-L1473
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)