Jump to content

Recommended Posts

is it possible to create an movable control or drawing 2d on the screen (basically a line from me to the player infront of me (enemy or sth else doesnt matter)) Because i use drawline3d and this su*** sorry for that but the rendering is very bad.

I could see a guy using lines 2d but doing it with 3d stuff as i said above drawing line from player to enemy nevermind this guy made it in arma 2 he said that he used an movable dialog but i want to do it in a control or with drawline but it seems to not work any ideas?

 

Edit**: I found the video where he did this here 

 

Thanks, Armanda551

  • Like 1

Share this post


Link to post
Share on other sites

Or simpler how can i draw lines in 3d space with Drawline Not Drawline3d

Share this post


Link to post
Share on other sites

an example of drawLine3D, that command should do exactly what you want

onEachFrame
{
	{
		_distance = round (_x distance player);
		if (_distance < 801 && _x != player) then
		{
			_color = [0,0,0,1];
			_side = side _x;
			switch (_side) do
			{
				case WEST: {_color = [0,0,1,1]};
				case EAST: {_color = [1,0,0,1]};
				case INDEPENDENT: {_color = [0,1,0,1]};
				case CIVILIAN: {_color = [0.4,0,1,1]};
			};
			_distance = round (_x distance player);
			_posID = _x modelToWorldVisual [0,0,0];
			_posBase = eyePos _x;
			_posTL1 = [(_posBase select 0) - 0.35, _posBase select 1, (_posBase select 2) - 4.9];
			_posBL1 = [(_posBase select 0) - 0.35, _posBase select 1, (_posBase select 2) - 6.5];
			_posTR1 = [(_posBase select 0) + 0.35, _posBase select 1, (_posBase select 2) - 4.9];
			_posBR1 = [(_posBase select 0) + 0.35, _posBase select 1, (_posBase select 2) - 6.5];
			_posTL2 = [_posBase select 0, (_posBase select 1) - 0.35, (_posBase select 2) - 4.9];
			_posBL2 = [_posBase select 0, (_posBase select 1) - 0.35, (_posBase select 2) - 6.5];
			_posTR2 = [_posBase select 0, (_posBase select 1) + 0.35, (_posBase select 2) - 4.9];
			_posBR2 = [_posBase select 0, (_posBase select 1) + 0.35, (_posBase select 2) - 6.5];
			
			if (_distance < 101) then
			{
				drawIcon3D ["", _color, _posID, 0, 00, 45, format ["%1: %2m", name _x, _distance], 0, 0.023];
			} else {drawIcon3D ["", _color, _posID, 0, 00, 45, format ["*%1m",_distance], 0, 0.023]};
			
			drawLine3D [_posTL1, _posTR1, _color];
			drawLine3D [_posTL1, _posBL1, _color];
			drawLine3D [_posTR1, _posBR1, _color];
			drawLine3D [_posBL1, _posBR1, _color];
			
			drawLine3D [_posTL2, _posTR2, _color];
			drawLine3D [_posTL2, _posBL2, _color];
			drawLine3D [_posTR2, _posBR2, _color];
			drawLine3D [_posBL2, _posBR2, _color];

		};
	} forEach allUnits;
};

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

RscLine example.

terminate h;
h = [] spawn {
	_display = findDisplay 46;
	_ctrl = _display ctrlCreate [ "RscLine", 10001 ];
	
	while { true } do {
		_bobPos = worldToScreen getPosATL bob;
		
		if !( _bobPos isEqualTo [] ) then {
			if ( ctrlFade _ctrl > 0 ) then {
				_ctrl ctrlSetFade 0;
			};
			_ctrl ctrlSetPosition[ 0.5, 0.5, ( _bobPos select 0 ) - 0.5, ( _bobPos select 1 ) - 0.5 ];
		}else{
			//Bob is occluded work out screen space here to bob dir
			_ctrl ctrlSetFade 1;
		};
				
		_ctrl ctrlCommit 0;
	};	
};

Where bob is the Object you are tracking. I have left you to work out screen space for when the object is occluded as its just toooo hot to have Arma running and I'm just too lazy :D

  • Like 2

Share this post


Link to post
Share on other sites

Cool it worked, so i want to know how to draw it just on the player there shouldnt be a line to my middle of the screen

5k7mGq8.png

Share this post


Link to post
Share on other sites

EDIT-**************

 

Forget this question above my bad 

 

How can i ctrlSetPosition the line between 2 points like in drawline3d. I have 2 model points with selectionPosition i want a line from point a to b

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

×