drawIcon3D: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 114: | Line 114: | ||
}] call BIS_fnc_addStackedEventHandler;</code> | }] call BIS_fnc_addStackedEventHandler;</code> | ||
'''(A3 1.32.127785)''' | '''(A3 1.32.127785)''' | ||
</dd> | |||
</dl> | |||
<dl class="command_description"> | |||
<dd class="notedate">Posted on November 13</dd> | |||
<dt class="note">[[User:Iceman77|Iceman77]]</dt> | |||
<dd class="note"> | |||
Remember that you can also use conditions to display and hide drawn 3d lines and icons. Here's a practical example, combining both drawLine3D and drawIcon3D. Works for both onEachFrame (stacked EH recommended) and EH. | |||
<code> | |||
addMissionEventHandler ["Draw3D", { | |||
_startPoint = getPos myObject; | |||
if (player distance _startPoint < 25) then { | |||
_endPoint = getPos myObject; | |||
_endPoint set [2,1]; | |||
drawLine3D [_startPoint, _endPoint, [0,0,0,0.5]]; | |||
drawIcon3D ["\a3\ui_f\data\gui\cfg\hints\BasicLook_ca.paa", [0,0,0,0.5], _endPoint, 1, 1, 0]; | |||
}; | |||
}]; | |||
</code> | |||
</dd> | </dd> | ||
</dl> | </dl> | ||
<!-- DISCONTINUE Notes --> | <!-- DISCONTINUE Notes --> |
Revision as of 07:38, 14 November 2014
Description
- Description:
- Draws an ingame icon at a given position. Command has to be executed each frame. Use onEachFrame or addMissionEventHandler "Draw3D"
- Groups:
- Uncategorised
Syntax
- Syntax:
- drawIcon3D [texture, color, pos, width, height, angle, text, shadow, textSize, font]
- Parameters:
- [texture, color, pos, width, height, angle, text, shadow, textSize, font]: Array
- texture: String
- color: Color
- pos: Position
- width: Number
- height: Number
- angle: Number
- text: String - (optional)
- shadow: Number - (optional)
- textSize: Number - (optional)
- font: String - (optional)
- Return Value:
- Nothing
Examples
- Example 1:
- Icon and text:
onEachFrame { drawIcon3D ["targetIcon.paa", [1,1,1,1], getPos cursorTarget, 1, 1, 45, "Target", 1, 0.05, "TahomaB"]; };
- Example 2:
- Just text:
addMissionEventHandler ["Draw3D", { drawIcon3D ["", [1,0,0,1], position cursorTarget, 0, 0, 0, "Target", 1, 0.05, "PuristaMedium"]; }];
Additional Information
- See also:
- drawLine3D
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Notes
- Posted on August 31, 2013
- Killzone_Kid
- As command syntax indicates, this command expects icon position in format Position meaning that over the land it expects PositionATL and over the sea PositionASL. Use additional ASLToATL and ATLToASL commands wherever is necessary. Alternatively use getPos or position commands, which will automatically adjust Z. To draw smooth moving icon for a moving object use visiblePosition and visiblePositionASL accordingly.
- Posted on September 23, 2013
- Killzone_Kid
- This command works well with addon textures, however getting it to display mission textures is a bit tricky. Follow this guide:
- Posted on April 19, 2014
- AgentRev
- Just a little precision to KK's first comment, this command expects PositionASLW over the sea, not regular ASL. Luckily, modelToWorld returns ATL over land and ASLW over sea, so if you want the icon to stay the the same place, you should use this snippet to find the correct position:
_pos = visiblePositionASL _object; _pos set [2, (_object modelToWorld [0,0,0]) select 2];
Bottom Section
- Posted on October 23, 2014 - 02:42 (UTC)
- DreadedEntity
-
drawIcon3D and BIS_fnc_addStackedEventHandler work well together.
Using formatting commands with drawIcon3D will not work, instead, they will be added to the string.
["uniqueID", "onEachFrame", { drawIcon3D["myIcon.jpg", [1,1,1,0.5], getPos player, 1, 1, 0, format["%1\n%2", "Dreaded", "Entity"]]; }] call BIS_fnc_addStackedEventHandler;
Shown text will be Dreaded\nEntity. (A3 1.32.127785)
The "text" parameter must be a string. You cannot use Structured_Text.
["uniqueID", "onEachFrame", { drawIcon3D [ "myIcon.jpg", [1,1,1,0.5], getPos player, 1, 1, 0, parseText format["<t size='1.25' font='PuristaLight' color='#ff0000'>%1%2</t>", Dreaded, Entity] ]; }] call BIS_fnc_addStackedEventHandler;
(A3 1.32.127785)
- Posted on November 13
- Iceman77
-
Remember that you can also use conditions to display and hide drawn 3d lines and icons. Here's a practical example, combining both drawLine3D and drawIcon3D. Works for both onEachFrame (stacked EH recommended) and EH.
addMissionEventHandler ["Draw3D", { _startPoint = getPos myObject; if (player distance _startPoint < 25) then { _endPoint = getPos myObject; _endPoint set [2,1]; drawLine3D [_startPoint, _endPoint, [0,0,0,0.5]]; drawIcon3D ["\a3\ui_f\data\gui\cfg\hints\BasicLook_ca.paa", [0,0,0,0.5], _endPoint, 1, 1, 0]; }; }];