Jump to content

Recommended Posts

Depends on what way something wouldn't be visible. Please elaborate.

Share this post


Link to post
Share on other sites

A line of sight check just checking if something is visible for your player.

Edit: i might of just found something testing it now.

Edit2: doesnt seem to be working.

Edited by xxxmlgxxxt

Share this post


Link to post
Share on other sites

Ah, the line of sight check.

I can't give you a ready to go script but you will likely find what you're looking for in any of these posts:

http://forums.bistudio.com/showthread.php?90864-Script-function-request-Line-of-sight-check

http://www.ofpec.com/forum/index.php?topic=36100.0

Kind regards,

Sanchez

Share this post


Link to post
Share on other sites

This should work:

_objecttocheck = myvehicleobjectormodeliwannacheck;

//You could also just use a position for a house and so on...
_position = getposATL _objecttocheck;

//returns: [] if not on screen, [1,1] lower right, [0,0] upper left
_screencoordinates = worldToScreen _position;

if ((count _screencoordinates) == 0) then {
player globalchat format ["Object: %1 not on screen!",typeOf _objecttocheck];
} else {
player globalchat format ["Object: %1 is visible on screen with the following coordinates: %2!",typeOf _objecttocheck, _screencoordinates];
};

Share this post


Link to post
Share on other sites

you can use this if you want.

/*
Description: checks line of site between 2 units. will return true if 'unit1' can see 'unit2'.
By: Nimrod_Z
*/
_unit1 = _this select 0;
_unit2 = _this select 1;

NRZ_eyeDir = {
_eval = (eyeDirection _this);
_edir = (_eval select 0) atan2 (_eval select 1);
if (_edir < 0) then {_edir = 360 + _edir};
_edir
};

_canSee = false;
_inView = [position _unit1, _unit1 call NRZ_eyeDir, 120, position _unit2] call BIS_fnc_inAngleSector; 
if (_inView) then 
{
if (! terrainIntersectASL [eyePos _unit1, eyePos _unit2]) then 
{
	if (count (lineIntersectsWith [eyePos _unit1, eyePos _unit2, _unit1, _unit2]) == 0) then 
	{
		_canSee = true;
	};			
};
};
_canSee

Share this post


Link to post
Share on other sites

Doesn't work in ArmA 2, the eyeDirection command was introduced in ArmA 3.

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  

×