Jump to content
7erra

Draw Trigger outline

Recommended Posts

Hi everyone!

 

Since I'm a noob with trigonometry I'd like to ask you how it is possible to draw the outline of a trigger with drawIcon3D. I have come so far that I can draw the border with predefined positions.

params ["_trigger"];
//_tParams = triggerArea _trigger;
//_tParams params ["_a","_b","_angle","_isRectangle","_c"];

_posArray = [ // predefined positions
	[4127,4112,1],
	[4127,4124,1],
	[4134,4124,1],
	[4134,4112,1]
];
_posArray apply {_x set [2,0.5]};
_posArray pushBack (_posArray select 0);
_posArray = _posArray apply {
	if ((count _posArray) > _posArray find _x) then {
		[_x,_posArray select ((_posArray find _x) +1),[0,1,0,1]]
	} else {
		[_x,_posArray select 0,[0,1,0,1]]
	};
};

while {triggerActivated _trigger} do {// other option: eachFrame MEH, but the array will be evaluated over and over. seems redundant as the trigger wont move. Also arguments have to be passed.
	{
		drawLine3D _x;
	} forEach _posArray;

	_curFrame = diag_frameno;
	waitUntil {_curFrame != diag_frameno};
};

 

Thanks,

 

7erra

  • Thanks 1

Share this post


Link to post
Share on other sites

This will do just that:

 

  • Like 3
  • Thanks 2

Share this post


Link to post
Share on other sites

ArmA rule #34: If it exists, there is code for it. If it isn't there will be.

 

Would you mind if I used the code in my mod?

  • Like 1

Share this post


Link to post
Share on other sites

Not at all, but beware as mentioned in the thread it will throw divider by zero errors next to triggers with no shape. It's an easy fix but I've been too busy to implement it. Also if you re use it I just ask that you leave the author credits (as is good practice) especially since my girlfriend helped me with the maths on that one :eyeheart:.

  • Like 1
  • Haha 1

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

×