Jump to content
Sign in to follow this  
SRBuckey5266

How can I check if an object is facing another object?

Recommended Posts

I can use getDir on a unit, but how can I check and see if a unit is within this units 180 degree view?

Basically, what I'm asking, can I check and see if a unit is within the view of another unit?

Share this post


Link to post
Share on other sites

Use BIS_fnc_inAngleSector

_isInView = [[color="#008000"]getPosATL player[/color], [color="#0000CD"]getdir player[/color], [color="#FF0000"]90[/color], [color="#FF8C00"]getPosATL _otherUnit[/color]] call BIS_fnc_inAngleSector

Position to check from.

Direction to check

Half the angle, or angle either side of direction

Position to check is in the angle

EDIT: You may also want to add to that a intersects command to make sure the player can actually draw a straight line to the other unit. As in its not behind a building or the other side of a hill etc

Edited by Larrow
  • Like 1

Share this post


Link to post
Share on other sites
Use BIS_fnc_inAngleSector

_isInView = [[color="#008000"]getPosATL player[/color], [color="#0000CD"]getdir player[/color], [color="#FF0000"]90[/color], [color="#FF8C00"]getPosATL _otherUnit[/color]] call BIS_fnc_inAngleSector

Position to check from.

Direction to check

Half the angle, or angle either side of direction

Position to check is in the angle

EDIT: You may also want to add to that a intersects command to make sure the player can actually draw a straight line to the other unit. As in its not behind a building or the other side of a hill etc

Thanks, this is a great help!

Where did you look to find this function? I looked at the ArmA 3 functions page on the wiki, and this wasn't one of the BIS functions.

Thanks again!!

Share this post


Link to post
Share on other sites

I have my PBO's unpacked and usually spend time trawling through them but you can see all the functions in the functions viewer in the editor as well.

I also found this page on the wiki the other week which is a complete list and looks like Tom_48_97 (Bohemia Interactive developer) is keeping it up to date. Each function also links to working pages as well :) lacking examples but majority seem to have C&P of function headers to show how to use them.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×