Jump to content
Sign in to follow this  
LoonyWarrior

Positioning... ever green for me.. :(

Recommended Posts

hi

i have trigger and i want to create marker right next to it..

helpya.jpg

i know how to do that for fig. A where the angle of the trigger is 0

_area = triggerArea TriggerName;

_position = [TriggerName, ((_area select 1) / 2) + 5, 0] call BIS_fnc_relPos;

_marker = createMarker ["MarkerName", _position];
_marker setMarkerShape "RECTANGLE";
_marker setMarkerColor "ColorGreen";
_marker setMarkerSize [_area select 0, 10];
_marker setMarkerDir _area select 2;

and i need to know how to do that for fig. B

thx for advice...

Share this post


Link to post
Share on other sites

FIG A:

_area = triggerArea Trig1;
//select 0 is the x axis, 90 degrees for right hand side
_trigpos = [Trig1, (_area select 0) + 5, 90] call BIS_fnc_relPos;
_marker = createMarker ["MarkerName", _trigpos];
_marker setMarkerShape "RECTANGLE";
_marker setMarkerColor "ColorGreen";
//5 in x radius, y = select 1 trigger y value
_marker setMarkerSize [5, (_area select 1)];
_marker setMarkerDir (_area select 2);

Despite what the WIKI says trigger and marker sizes are radius not axis length (diameter). Pass BIS_fnc_relPos 90 for the right hand edge.

FIG B: (presuming trigger direction is 45 degrees/NE)

_area = triggerArea Trig1;
//select 2 = current direction of trigger, +270 for right edge
_trigpos = [Trig1, (_area select 0) + 5, (_area select 2)+270] call BIS_fnc_relPos;
_marker = createMarker ["MarkerName", _trigpos];
_marker setMarkerShape "RECTANGLE";
_marker setMarkerColor "ColorGreen";
_marker setMarkerSize [5, (_area select 1)];
_marker setMarkerDir (_area select 2);

Pass into BIS_fnc_relPos the angle the trigger is at, plus 270 for the left hand edge.

FIG B: (presuming trigger direction is 315 degrees/NW)

_area = triggerArea Trig1;
//select 1 for height, 
_trigpos = [Trig1, (_area select 1) + 5, (_area select 2)] call BIS_fnc_relPos;
_marker = createMarker ["MarkerName", _trigpos];
_marker setMarkerShape "RECTANGLE";
_marker setMarkerColor "ColorGreen";
//select 0 as x axis will be the ful length
_marker setMarkerSize [(_area select 0) , 5];
_marker setMarkerDir (_area select 2);

________________________________________________

Edited by Larrow

Share this post


Link to post
Share on other sites

there is no difference in my code and yours... ?

// get trigger position and angle
_area = triggerArea TriggerName;

// create new position
// u have rectangle 400x400 and u want marker with width 10
// u have to take half.... from each value....... 200 + 5
_position = [TriggerName, ((_area select 1) / 2) + 5, 0] call BIS_fnc_relPos;

// create marker
_marker = createMarker ["MarkerName", _position];
_marker setMarkerShape "RECTANGLE";
_marker setMarkerColor "ColorGreen";
// set marker size... 400x10
_marker setMarkerSize [_area select 0, 10];
// set same angle as trigger
_marker setMarkerDir _area select 2;

---------- Post added at 19:50 ---------- Previous post was at 18:58 ----------

oki i finally got that... thanks...

_area2 = triggerArea LW_OuterBorder;

_position1 = [LW_OuterBorder, (_area2 select 1) + 10, (_area2 select 2) + 180] call BIS_fnc_relPos;


_marker2 = createMarker ["Marker2", _position1];
_marker2 setMarkerShape "RECTANGLE";
_marker2 setMarkerColor "ColorBlack";
_marker2 setMarkerSize [(_area2 select 0) + 20, 10];
_marker2 setMarkerDir (_area2 select 2);


_position2 = [LW_OuterBorder, (_area2 select 0) + 10, (_area2 select 2) + 270] call BIS_fnc_relPos;


_marker3 = createMarker ["Marker3", _position2];
_marker3 setMarkerShape "RECTANGLE";
_marker3 setMarkerColor "ColorBlack";
_marker3 setMarkerSize [_area2 select 1, 10];
_marker3 setMarkerDir ((_area2 select 2) + 90);


_position3 = [LW_OuterBorder, (_area2 select 1) + 10, (_area2 select 2)] call BIS_fnc_relPos;

_marker4 = createMarker ["Marker4", _position3];
_marker4 setMarkerShape "RECTANGLE";
_marker4 setMarkerColor "ColorBlack";
_marker4 setMarkerSize [(_area2 select 0) + 20, 10];
_marker4 setMarkerDir (_area2 select 2);

_position4 = [LW_OuterBorder, (_area2 select 0) + 10, (_area2 select 2) + 90] call BIS_fnc_relPos;

_marker5 = createMarker ["Marker5", _position4];
_marker5 setMarkerShape "RECTANGLE";
_marker5 setMarkerColor "ColorBlack";
_marker5 setMarkerSize [_area2 select 1, 10];
_marker5 setMarkerDir (_area2 select 2) + 90;

Share this post


Link to post
Share on other sites

Made a little function for you

////////////////////////////////////////////////////
//_frameMarkers = [trig1, 5 ] call FNC_FrameTrigger;
/////////////////////////////////////////////

FNC_FrameTrigger = {
_trig = _this select 0;
_width = _this select 1;
_area = triggerArea _trig;
_return = [];
{
	_oppAxis = _forEachIndex mod 2;
	_axis = _oppAxis * -1 +1;
	_trigpos = [_trig, (_area select _axis) + _width, (_area select 2)+ _x] call BIS_fnc_relPos;
	_markerName = format ["%1Frame%2", _trig, _forEachIndex];
	_marker = createMarker [_markerName, _trigpos];
	_marker setMarkerShape "RECTANGLE";
	_marker setMarkerColor "ColorGreen";
	_marker setMarkerSize [(_area select _oppAxis) + ((_width * _oppAxis) * 2), _width];
	_marker setMarkerDir ((_area select 2) + _x);
	_return = _return + [_marker];
}forEach [0,90,180,270];
_return
};

Edited by Larrow
oops had axis back to front :/

Share this post


Link to post
Share on other sites
Made a little function for you

that was planned like next step... ...and now it looks like its already done.. :)

really thanks...

...im working on implementation to the BorderGuard ;)

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  

×