Newer vid (by McLupo) with eye direction demonstration:
Here is example of the new LOS commands that came with the recent beta. I have two units on map (AI named b, player a) and functions module placed on map. LOS is counted for eye positions and eye directions for AI . Use, edit & expand freely.
Requires Beta 94103 or newer.
LOS.sqf:
LOSforSingleCheck.sqf:Code:private ["_a","_b","_dirTo","_eyeD","_eyePb","_eyePa","_eyeDV"]; //Player _a = _this select 0; //AI to see or not _b = _this select 1; while {true} do { _eyeDV = eyeDirection _b; _eyeD = ((_eyeDV select 0) atan2 (_eyeDV select 1)); if (_eyeD < 0) then {_eyeD = 360 + _eyeD}; _dirTo = [_b, _a] call BIS_fnc_dirTo; _eyePb = eyePos _b; _eyePa = eyePos _a; if ((abs(_dirTo - _eyeD) >= 90 && (abs(_dirTo - _eyeD) <= 270)) || (lineIntersects [_eyePb, _eyePa]) ||(terrainIntersectASL [_eyePb, _eyePa])) then { hintsilent "NOT IN SIGHT"; } else { hintsilent "IN SIGHT"; }; sleep 0.1; };
https://www.dropbox.com/s/5644ns4x9o...ht.Desert_E.7zCode:private ["_a","_b","_dirTo","_eyeD","_eyePb","_eyePa","_eyeDV"]; //Player _a = _this select 0; //AI to see or not _b = _this select 1; _eyeDV = eyeDirection _b; _eyeD = ((_eyeDV select 0) atan2 (_eyeDV select 1)); if (_eyeD < 0) then {_eyeD = 360 + _eyeD}; _dirTo = [_b, _a] call BIS_fnc_dirTo; _eyePb = eyePos _b; _eyePa = eyePos _a; if ((abs(_dirTo - _eyeD) >= 90 && (abs(_dirTo - _eyeD) <= 270)) || (lineIntersects [_eyePb, _eyePa]) ||(terrainIntersectASL [_eyePb, _eyePa])) then { hintsilent "NOT IN SIGHT"; } else { hintsilent "IN SIGHT"; };
HOME 


Reply With Quote



