Jump to content
Sign in to follow this  
rejenorst

CQB - checking if unit has LOS through target command

Recommended Posts

Hi I am attempting to modify my building patrol script(s).

Basically I am looking for a way to check if a unit has a target in his LOS (line of sight). If he doesn't the script will tell him to displace to another position. Is it possible to find an accurate way to check if a unit has a target LOS?

I know we there's no LOS commands so am hoping to try another way, possibly through target command(s).

EDIT: Closest I came to anything useful was here: http://forums.bistudio.com/showthread.php?t=74790&highlight=los

Edited by Rejenorst

Share this post


Link to post
Share on other sites

BIS_fnc_inAngleSector

Purpose: Checks if a position lies within an angle sector

Arguments: [<center position>,<center angle of sector>,<sector width>,<position>]

Return: boolean

Returns true if <position> lies within the sector defined by <center position>,

<center angle of sector> and <sector width>. Use this function to determine if

a position lies within a certain angle from another position (ie the <center position>).

Example:

[position player,getdir player,30,position enemy_tank] call BIS_fnc_inAngleSector

will return true if the vehicle named enemy_tank is within 30 degrees of where the player is pointing.

Share this post


Link to post
Share on other sites

But does that function check line of sight? If you have target in your viewing sector, it can still be blocked? I've never seen ray checks in OA, but TKOH seems to have something going.

I only know how to do line of sight checks against terrain, but it involves placing objects and reading their placed altitude compared to line altitude at that location. Bigger sample distances of clearance is good, reduce it if clearance is low. Probably too heavy to use for several AI, and I wouldn't know how to check against buildings or trees.

Share this post


Link to post
Share on other sites

Ive tried alot of different techniques and it seems almost impossible to get crisp LOS checking no matter what I try. It would be best if BIS just made a simple command as the game has it as the AI dont shoot untill they have LOS to a target. I am trying to get more info on the intersect command.

It is also possible to use a laser designater by pointing it at a target area and simply checking if the LD object is at the target position. The logic is clean but its a cumbersome proof of concept at best and I cant see it being used practically. Someone has to make a special LOS addon that gives us a function or special unit (like an invisible silent weapon that fires at a target and checks if the projectile made it). It would be a great help.

Share this post


Link to post
Share on other sites

Well there is the new command in TAKOH:

_bool = lineIntersects [begPos, endPos, withObj, ignoreObj];

but I haven't been able to get anything but false from it so far.

Unfortunately it appears it will only deal with object references, excluding things like terrain, trees, houses, and rocks etc.

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  

×