Jump to content

Recommended Posts

HI All,

 

I'm trying to get the a laserTarget on a soldier with a player or AI user the Laser Designator to target units.

 

The laserTarget appears on all units, including soldiers in static weapons but passes through all other soldiers.

 

#1) Any advise on creating a laserTarget attachedTo  a soldier and deleting working around removing the one that passes through the soldier?

 

Here is the script I'm using for creating a laser line and laserTarget.

params ["_startObject"];

if (isNull _startObject) exitwith {};

["laser", "onEachFrame", {
	params ["_startObject"];
	//if (currentVisionMode _startObject == 1) exitwith {};
	_designatedObj = laserTarget _startObject;
	if !(isNull _designatedObj) then {				
		_lasercolour = [1,0,0,1.5-sunOrmoon]; // first 3 numbers are RGB
		_range = 2500; // laser range
		_maxsize = 5; 
		_start = ASLToAGL eyePos _startObject;
		_end = getPos _designatedObj;
		_int = lineIntersectsSurfaces [atltoasl _start, atltoasl _end, _startObject, _designatedObj, true, 1, "VIEW", "GEOM"];
		_size = _maxsize;
	
		//hintSilent format ["_int: %1", _int];
		
		if !(_int isEqualTo []) then {
			_end = (_int select 0) select 0;
			_end = asltoagl _end;
			_length = _start vectorDistance _end;
			systemchat format ["_length: %1 _int: %2 ", round _length, typeOf ((_int select 0) select 2)];						
			if (_length >= _range) then {
				_size = 0;
			} else {
				_size = _maxsize;
			};
			if (_length < 1) then {_size = 0};
		} else {
			_length = _start vectorDistance _end;
			systemchat format ["_length: %1", round _length];
		};
		drawLine3D [_start, _end, _lasercolour]; // comment this out to remove the line
		drawIcon3D ["\a3\data_f\car_light_flare2.paa", _lasercolour, _end, _size, _size, random 360, "", 0, 0.05, "PuristaMedium"];	
},[_startObject]] call BIS_fnc_addStackedEventHandler;

#2) ALSO, Is there a way to make the actual laserTarget generated from the laser designator visible in daylight. I would like to use it instead if I can as it scales in size with distance appropriately?

I've tried playing with  setLightIntensity, setLightBrightness, setLightColor and setLightDayLight but had not luck.

 

thanks

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

×