Search the Community
Showing results for tags 'drawicon3d'.
Found 7 results
-
See player's drawIcon3D through walls
Sneax x posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi, i got the following drawIcon3D script that shows the players names above their heads: onEachFrame { _units = nearestObjects[(visiblePosition player),["Man"], 17]; _units = _units; { _color = switch (playerSide) do { case (EAST): {[1,0,0,1]}; case (WEST): {[0,0,1,1]}; case (independent): {[0,1,0,1]}; case default {[2.55,0.55,0,10]}; }; if (side _x isEqualto playerSide) then { if (!(lineIntersects [getPos player, getPos _x, player, _x]) && alive _x) then { drawIcon3D [ "", _color, [visiblePosition _x select 0,visiblePosition _x select 1, (visiblePosition _x select 2) +((_x ModelToWorld (_x selectionPosition "player")) select 2)+ 1.83], 45, -2, -1, name _x, 2, 0.035, "Puristamedium", "center" ]; }; }; }forEach _units; }; the problem: this shows also the names thought objects where i cant see the player normaly... how can i fix this? also it would be nice if my enime is in a car i would see his name above the car (not works now). Thx for your answer's 😄- 15 replies
-
- drawicon3d
- arma3
-
(and 3 more)
Tagged with:
-
solution Multi-line Text in drawIcon3D
Whalenator posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I've been struggling for some time to create a nametag script that could: - use drawIcon3D to place the tags over players (like F3) instead of center screen (like ST) - have multiple lines of text for player roles, group names, etc - display these multiple lines (in 3D) as if they were one big sprite (psuedo-2D) ( Pictures available here ) drawIcon3D does not support structured text. It does not support text over multiple lines, or with a different justification, or any of that. You can render an icon, and you can render some text. That icon and text will always face you, and will appear the same size no matter the distance between your player and the drawIcon3D's position, but if you want to display multiple lines of text stacked upon each other you were out of luck. I was out of luck. I tried a few things. My original solution was to use the easy method (modelToWorld[0,0,0] + height for stance, +/- static Z-level spacing between tags) F3 uses, but to dynamically change the spacing between 3D icons on-screen depending on player FOV and distance to target. As you moved closer or further, the tags would space out or scrunch up in 3D accordingly. The problem? That solution only changed the Z levels of the tags, meaning that if I looked down on the tags from above (or up from below, or really any angle other than flat horizontal) the visual spacing would decrease until they appeared to overlap each other. The next attempt adjusted the spacing by first converting the world coordinates to screen coordinates (worldToScreen), adjusting those screen coordinates with a fixed Y spacing, and then converting them back into world coordinates before displaying them (screenToWorld). It worked, for the most part. Tags viewed from above would be spaced out perfectly. The problem here was twofold: first, screenToWorld gets the world position (going through models and buildings) at the screen position given, even if that world position is kilometers away. The drawIcon3D text looks the same size at any distance, of course, but this lead into a bigger problem -- If you were looking at someone and there was no "world" behind them (ie: just a sky) then screenToWorld would be unable to find a world position, and the tag would not appear. I had no idea what to do at this point and repeatedly turned to the Arma 3 Discord for help. A lot of people offered advice for which I am very grateful, but I am especially thankful towards cptnnick for helping me work through a solution to the dynamic spacing problem using orthogonal vectors and vector cross products. The solution is available in simplified form in my (unreleased, beta) nametag script, but a more expanded (and easily explained) process is this commented demonstration code graciously provided by cptnnick: comment "Setup. Not part of dynamic spacing solution."; removeMissionEventHandler ["Draw3D",missionNamespace getVariable ["drawHandler",-1]]; drawHandler = addMissionEventHandler ["Draw3D", { comment "Get the target object and player."; _target = cursorObject; _player = player; comment "Get the position of the player's camera and the middle of the target's body."; _targetPosition = _target modelToWorldVisual[0,0,1.3]; _playerPosition = positionCameraToWorld[0,0,0]; comment "Calculate the distance from target to player."; _distance = _targetPosition distance _playerPosition; comment "Get the player's current zoom level. Google 'Killzone Kid Get Zoom.'"; _fov = call wh_nt_fnc_getZoom; comment "Get the vector from target to player (GREEN LINE)."; _dir = _targetPosition vectorDiff _playerPosition; comment "NEW: vectorDir _player doesn't work when the player is using freelook."; comment "To get the vectorDir of the player's camera instead of his body, do this:"; _playerDir = _playerPosition vectorFromTo positionCameraToWorld[0,0,1]; comment "Get a vector orthogonal to the player's orientation (RED LINE)."; _cross = (_playerDir) vectorCrossProduct (vectorUp _player); comment "Get the relative "UP" direction of the target model (PURPLE LINE)."; _drawUpNormal = vectorNormalized (_cross vectorCrossProduct _dir); comment "Multiply the direction by how far we want the text spaced."; _drawUp = _drawUpNormal vectorMultiply (0.1 * _distance / _fov); comment "Flip it for down."; _drawDown = _drawUp vectorMultiply -1; _drawPosUp = _targetPosition vectorAdd _drawUp; _drawPosDown=_targetPosition vectorAdd _drawDown; comment "Render some cool drawIcon3D stuff with your new, dynamically-spaced positions."; drawLine3D [_targetPosition, _drawPosUp, [1,0,0,1]]; drawLine3D [_targetPosition, _playerPosition, [0,1,0,1]]; drawLine3D [_targetPosition, _targetPosition vectorAdd _cross, [0,0,1,1]]; drawIcon3D ["", [1,1,1,1], _drawPosUp, 0, 0, 0, "TOP", 2, 0.04, "RobotoCondensed"]; drawIcon3D ["", [1,1,1,1], _targetPosition, 0, 0, 0, "MIDDLE", 2, 0.04, "RobotoCondensed"]; drawIcon3D ["", [1,1,1,1], _drawPosDown, 0, 0, 0, "BOTTOM", 2, 0.04, "RobotoCondensed"]; }];- 2 replies
-
- 3
-
- drawicon3d
- nametags
-
(and 4 more)
Tagged with:
-
Okay, so i'm trying to get drawIcon3D to work the same way as the code below, however this only shows the units drawicon3d if the player's eyes are in view of the unit. I would like for it to be in the view of the players camera (internal or external) rather than the eye position of the player, thanks in advance to anyone willing to help me as it has been annoying me for a long time. if (!(lineIntersects [eyePos vehicle cameraOn, eyePos _unit, vehicle cameraOn, _unit]) && isNull objectParent _unit) then { drawIcon3D['', _colour, _pos, 0, 1.0, 0, _name, 1, 0.0345, "RobotoCondensed", "center", false]; };
-
Im displaying an image on a person and my picture is going to be bigger when im going away. I want that it is going bigger when im going nearer and smaller when im going nearer how can i calculate this is that possible thanks :) https://community.bistudio.com/wiki/drawIcon3D
-
[SOLVED] Grenade owner/side/group (Grenade Indicators)
HazJ posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi all, I made grenade indicators two years ago and came around to move/update code, etc and I just don't like the way I did it but I can't seem to think of any other way. Each client has FiredNear EH which checks if grenade and then adds it to appropriate array. if (isNil "groupIndex") then { groupIndex = 1; } else { groupIndex = groupIndex + 1; }; bluforGrenades = []; opforGrenades = []; groupGrenades = []; call compile format ["group%1Grenades = [];", groupIndex]; The reason for call compile + groupIndex is Independent isn't one side. It is a solo team with groups system so friendly grenades would show for separate group. Grenades doesn't appear to have side, I have tried owner and a few other things as well but had no luck. Surely there must be a better way of doing this? I just can't think what. Any help would be great! Below is a video, you may want to mute your volume as I had Smooth radio running in background lol. Not my daily bus route music but I find it relaxing when coding in ArmA, lol. We all need to be relaxed when coding in ArmA, or even sometimes playing it. As we all know lol... "ArmA'd" The last AI was determined to get away from being fragged with the grenade, but I was more determined! As you can see in the video, lol.- 11 replies
-
- 2
-
- grenades
- drawicon3d
-
(and 2 more)
Tagged with:
-
Making text appear with keypress and then fade out
Leopard20 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi. I am trying to make a script where the nearby AI names appear next to them (using drawIcon3D) when a certain key is pressed. I want their names to appear the instant the key is pressed and start to fade out in the next 5 seconds. How can I do that? P.S: I don't want you to describe all the steps! So far my script successfully shows the AI names (when the player is within 50 meters of them); I just need help with the fade out part.- 11 replies
-
- drawicon3d
- countdown
-
(and 1 more)
Tagged with:
-
DrawIcon3d Fade in and out with keypress
Leopard20 posted a topic in ARMA 3 - ADDONS - CONFIGS & SCRIPTING
Hi. I am trying to make a script where the nearby AI names appear next to them (using drawIcon3D) when a certain key is pressed. I want their names to appear the instant the key is pressed and start to fade out in the next 5 seconds. How can I do that? P.S: I don't want you to describe all the steps! So far my script successfully shows the AI names (when the player is within 50 meters of them); I just need help with the fade out part.