iceman77 19 Posted November 18, 2014 I'm attaching 3Dlines and a 3Dicon to a few pilot's corpses in my SP mission. I would like the 3D lines and icon(s) to "swivel" on the corpse's position relative to the player's position. If you check out the code in the editor, note the lines and icon(s) are static. Which is okay, but I wanted to do a bit more. However I'm bad at math and such. Or simply lack the ability to make this happen otherwise. Any help is appreciated. DEADPILOTS = []; { if (getText (configfile >> "CfgVehicles" >> typeOf _x >> "textSingular") == "pilot") then { DEADPILOTS pushBack _x; _x addAction ["Search Pilot", {(_this select 0) call SSC_fnc_pilotSearch;}, [], 0, false, true, "", "!(_this getVariable 'PLAYER_HAS_KEYS') && _this distance _target <= 3" ]; }; } forEach allDeadMen; Color75 = [ (profilenamespace getvariable ['GUI_BCG_RGB_R', 0.75]), (profilenamespace getvariable ['GUI_BCG_RGB_G', 0.75]), (profilenamespace getvariable ['GUI_BCG_RGB_B', 0.75]), 0.75 ]; addMissionEventHandler ["Draw3D", { if ( { player distance _x <= 25 } count DEADPILOTS > 0 ) then { { private ["_corpsePos","_line1_start","_line1_end","_line2_start"]; _corpsePos = getPos _x; if (player distance _corpsePos <= 25) then { _line1_start = _corpsePos; _line1_end = [(_line1_start select 0), (_line1_start select 1), 0.5]; _line2_start = [(_line1_end select 0), (_line1_end select 1) + 0.5, (_line1_end select 2)]; drawLine3D [_line1_start, _line1_end, Color75]; drawLine3D [_line1_end, _line2_start, Color75]; drawIcon3D ["#(argb,8,8,3)color(1,1,1,1)", [0,0,0,0.5], _line2_start, 0.5, 0.5, 0]; drawIcon3D ["\a3\ui_f\data\gui\cfg\hints\Take_ca.paa", Color75, _line2_start, 0.5, 0.5, 0]; }; } forEach DEADPILOTS; }; }]; Share this post Link to post Share on other sites
dreadedentity 278 Posted November 18, 2014 I'm not sure what you mean by swivel, just spinning? I don't have much experience with drawLine3D but for drawIcon3D I'm not sure they have direction, so it's not possible to rotate them? Not really sure, try changing the 'angle' value and see what happens I guess Share this post Link to post Share on other sites
iceman77 19 Posted November 18, 2014 (edited) Swiveling - Well, if you check out the code in the editor you can see it draws a 90 degree angle (2 lines) with an icon attached at the end. I would like the entire 90 and icon to pivot or swivel, using the corpse as the anchor point. If that makes sense. In any case SOLUTION EXAMPLE Place a static unit or any static object named bob. Optional: this setDamage 1 in his init line note: If you use a moving object use visiblePosition bob or getPosVisual bob rather than getPos bob. init.sqf // Larrow Color75 = [ (profilenamespace getvariable ['GUI_BCG_RGB_R', 1]), (profilenamespace getvariable ['GUI_BCG_RGB_G', 1]), (profilenamespace getvariable ['GUI_BCG_RGB_B', 1]), 0.75 ]; addMissionEventHandler ["Draw3D", { _angleToPlayer = [ bob, player ] call BIS_fnc_dirTo; _lineStart = getPos bob; _lineEnd = _lineStart vectorAdd [ 0, 0, 0.5 ]; _line2End = [ _lineEnd, 0.5, _angleToPlayer + 90 ] call BIS_fnc_relPos; drawLine3D [_lineStart, _lineEnd, Color75]; drawLine3D [_lineEnd, _line2End, Color75]; drawIcon3D ["#(argb,8,8,3)color(1,1,1,1)", [0,0,0,0.5], _line2End, 0.5, 0.5, 0]; drawIcon3D ["\a3\ui_f\data\gui\cfg\hints\Take_ca.paa", Color75, _line2End, 0.5, 0.5, 0]; }]; Edited November 18, 2014 by Iceman77 Share this post Link to post Share on other sites
lappihuan 178 Posted November 19, 2014 I'm not 100% what you want, but i think the only thing you missed is that this needs to be executed in a onEachFrame EventHandler... Share this post Link to post Share on other sites
iceman77 19 Posted November 19, 2014 (edited) The Mission Event Handler works fine and the posted solution works. The code in the original post actually works too. I just needed the 90 and icon to swivel and Larrow hooked it up on that end :) Edited November 19, 2014 by Iceman77 Share this post Link to post Share on other sites