Create
Abort Abort If Abort If Condition Is False Abort If Condition Is True Add Health Pool To Player Allow Button Apply Impulse Attach Players Big Message Break Call Subroutine Cancel Primary Action Chase Global Variable At Rate Chase Global Variable Over Time Chase Player Variable At Rate Chase Player Variable Over Time Clear Status Communicate Continue Create Beam Effect Create Dummy Bot Create Effect Create HUD Text Create Homing Projectile Create Icon Create In-World Text Create Progress Bar HUD Text Create Progress Bar In-World Text Create Projectile Create Projectile Effect Damage Declare Match Draw Declare Player Victory Declare Round Draw Declare Round Victory Declare Team Victory Destroy All Dummy Bots Destroy All Effects Destroy All HUD Text Destroy All Icons Destroy All In-World Text Destroy All Progress Bar HUD Text Destroy All Progress Bar In-World Text Destroy Dummy Bot Destroy Effect Destroy HUD Text Destroy Icon Destroy In-World Text Destroy Progress Bar HUD Text Destroy Progress Bar In-World Text Detach Players Disable Built-In Game Mode Announcer Disable Built-In Game Mode Completion Disable Built-In Game Mode Music Disable Built-In Game Mode Respawning Disable Built-In Game Mode Scoring Disable Death Spectate All Players Disable Death Spectate Target HUD Disable Game Mode HUD Disable Game Mode In-World UI Disable Hero HUD Disable Inspector Recording Disable Kill Feed Disable Messages Disable Movement Collision With Environment Disable Movement Collision With Players Disable Nameplates Disable Scoreboard Disable Text Chat Disable Voice Chat Disallow Button Else Else If Enable Built-In Game Mode Announcer Enable Built-In Game Mode Completion Enable Built-In Game Mode Music Enable Built-In Game Mode Respawning Enable Built-In Game Mode Scoring Enable Death Spectate All Players Enable Death Spectate Target HUD Enable Game Mode HUD Enable Game Mode In-World UI Enable Hero HUD Enable Inspector Recording Enable Kill Feed Enable Messages Enable Movement Collision With Environment Enable Movement Collision With Players Enable Nameplates Enable Scoreboard Enable Text Chat Enable Voice Chat End For Global Variable For Player Variable Go To Assemble Heroes Heal If Kill Log To Inspector Loop Loop If Loop If Condition Is False Loop If Condition Is True Modify Global Variable Modify Global Variable At Index Modify Player Score Modify Player Variable Modify Player Variable At Index Modify Team Score Move Player To Team Pause Match Time Play Effect Preload Hero Press Button Remove All Health Pools From Player Remove Health Pool From Player Remove Player Reset Player Hero Availability Respawn Restart Match Resurrect Return To Lobby Set Ability 1 Enabled Set Ability 2 Enabled Set Ability Charge Set Ability Cooldown Set Ability Resource Set Aim Speed Set Ammo Set Crouch Enabled Set Damage Dealt Set Damage Received Set Environment Credit Player Set Facing Set Global Variable Set Global Variable At Index Set Gravity Set Healing Dealt Set Healing Received Set Invisible Set Jump Enabled Set Jump Vertical Speed Set Knockback Dealt Set Knockback Received Set Match Time Set Max Ammo Set Max Health Set Melee Enabled Set Move Speed Set Objective Description Set Player Allowed Heroes Set Player Health Set Player Score Set Player Variable Set Player Variable At Index Set Primary Fire Enabled Set Projectile Gravity Set Projectile Speed Set Reload Enabled Set Respawn Max Time Set Secondary Fire Enabled Set Slow Motion Set Status Set Team Score Set Ultimate Ability Enabled Set Ultimate Charge Set Weapon Skip Skip If Small Message Start Accelerating Start Assist Start Camera Start Damage Modification Start Damage Over Time Start Facing Start Forcing Dummy Bot Name Start Forcing Player Outlines Start Forcing Player Position Start Forcing Player To Be Hero Start Forcing Spawn Room Start Forcing Throttle Start Game Mode Start Heal Over Time Start Healing Modification Start Holding Button Start Modifying Hero Voice Lines Start Rule Start Scaling Barriers Start Scaling Player Start Throttle In Direction Start Transforming Throttle Stop Accelerating Stop All Assists Stop All Damage Modifications Stop All Damage Over Time Stop All Heal Over Time Stop All Healing Modifications Stop Assist Stop Camera Stop Chasing Global Variable Stop Chasing Player Variable Stop Damage Modification Stop Damage Over Time Stop Facing Stop Forcing Dummy Bot Name Stop Forcing Player Outlines Stop Forcing Player Position Stop Forcing Player To Be Hero Stop Forcing Spawn Room Stop Forcing Throttle Stop Heal Over Time Stop Healing Modification Stop Holding Button Stop Modifying Hero Voice Lines Stop Scaling Barriers Stop Scaling Player Stop Throttle In Direction Stop Transforming Throttle Teleport Unpause Match Time Wait Wait Until While
Ability Charge Ability Cooldown Ability Icon String Ability Resource Absolute Value Add All Damage Heroes All Dead Players All Heroes All Living Players All Players All Players Not On Objective All Players On Objective All Support Heroes All Tank Heroes Allowed Heroes Altitude Of Ammo And Angle Between Vectors Angle Difference Append To Array Arccosine In Degrees Arccosine In Radians Arcsine In Degrees Arcsine In Radians Arctangent In Degrees Arctangent In Radians Array Array Contains Array Slice Assist Count Attacker Backward Button Char In String Closest Player To Color Compare Control Mode Scoring Percentage Control Mode Scoring Team Cosine From Degrees Cosine From Radians Count Of Cross Product Current Array Element Current Array Index Current Game Mode Current Map Custom Color Custom String Damage Modification Count Damage Over Time Count Direction From Angles Direction Towards Distance Between Divide Dot Product Down Empty Array Entity Count Entity Exists Evaluate Once Event Ability Event Damage Event Direction Event Healing Event Player Event Was Critical Hit Event Was Environment Event Was Health Pack Eye Position Facing Direction Of False Farthest Player From Filtered Array First Of Flag Position Forward Game Mode Global Global Variable Has Spawned Has Status Heal Over Time Count Healee Healer Healing Modification Count Health Health of Type Hero Hero Being Duplicated Hero Icon String Hero Of Horizontal Angle From Direction Horizontal Angle Towards Horizontal Facing Angle Of Horizontal Speed Of Host Player Icon String If-Then-Else Index Of Array Value Index Of String Char Input Binding String Is Alive Is Assembling Heroes Is Between Rounds Is Button Held Is CTF Mode In Sudden Death Is Communicating Is Communicating Any Is Communicating Any Emote Is Communicating Any Spray Is Communicating Any Voice line Is Control Mode Point Locked Is Crouching Is Dead Is Dummy Bot Is Duplicating Is Firing Primary Is Firing Secondary Is Flag At Base Is Flag Being Carried Is Game In Progress Is Hero Being Played Is In Air Is In Alternate Form Is In Line of Sight Is In Setup Is In Spawn Room Is In View Angle Is Jumping Is Match Complete Is Meleeing Is Moving Is Objective Complete Is On Ground Is On Objective Is On Wall Is Portrait On Fire Is Reloading Is Standing Is Team On Defense Is Team On Offense Is True For All Is True For Any Is Using Ability 1 Is Using Ability 2 Is Using Ultimate Is Waiting For Players Last Assist ID Last Created Entity Last Created Health Pool Last Damage Modification ID Last Damage Over Time ID Last Heal Over Time ID Last Healing Modification ID Last Of Last Text ID Left Local Player Local Vector Of Magnitude Of Map Mapped Array Match Round Match Time Max Max Ammo Max Health Max Health of Type Min Modulo Multiply Nearest Walkable Position Normalize Normalized Health Not Null Number of Dead Players Number of Deaths Number of Eliminations Number of Final Blows Number of Heroes Number of Living Players Number of Players Number of Players On Objective Number of Slots Objective Index Objective Position Opposite Team Of Or Payload Position Payload Progress Percentage Player Carrying Flag Player Closest To Reticle Player Hero Stat Player Stat Player Variable Players In Slot Players On Hero Players Within Radius Players in View Angle Point Capture Percentage Position Of Raise To Power Random Integer Random Real Random Value In Array Randomized Array Ray Cast Hit Normal Ray Cast Hit Player Ray Cast Hit Position Remove From Array Right Round To Integer Score Of Server Load Server Load Average Server Load Peak Sine From Degrees Sine From Radians Slot Of Sorted Array Spawn Points Speed Of Speed Of In Direction Square Root String String Contains String Length String Replace String Slice String Split Subtract Tangent From Degrees Tangent From Radians Team Of Team Score Text Count Throttle Of Total Time Elapsed True Ultimate Charge Percent Up Update Every Frame Value In Array Vector Vector Towards Velocity Of Vertical Angle From Direction Vertical Angle Towards Vertical Facing Angle Of Vertical Speed Of Victim Weapon Workshop Setting Combo Workshop Setting Hero Workshop Setting Integer Workshop Setting Real Workshop Setting Toggle World Vector Of X Component Of Y Component Of Z Component Of

Rendering an In-World Text at a specific onscreen position Last updated September 11, 2023

For creating player HUDs, sometimes it can be advantageous to use In-World Texts instead of HUD Texts.

Pros:

  • Easier to place text where you want it, such as at the bottom of the screen, compared to HUD Texts
  • Fine control over text size
  • Can be seen after the match has ended

Cons:

  • The exact position of the text will be affected by the viewing player's FoV. This can be avoided by using Start Camera, which has a fixed FoV of about 102.5
  • In certain situations, the extra readability of a HUD Text header may be more desirable
  • Custom Strings containing newlines typically interfere with the alignment of In-World Texts on the screen
  • This technique has yet to be properly tested with In-World Progress Bar Texts and Icons

A quick note about screen coordinates

In this implementation, the origin [(x,y) = (0,0)] is at the center of the screen (on the crosshair), positive x is toward the right, and positive y is towards the top of the screen. If the text is viewed in first person, it is recommended to limit the x coordinate to ±2.5 and the y coordinate to ±1.25, since these are more or less the limits of the screen for a player on the lowest possible FoV and a 16:9 aspect ratio. The border values for Start Camera are not listed here but would be larger due to the fixed FoV (approx. equivalent to 102.48 degrees).

Option 1: First person using Event Player

This is the simplest option. It will use one text per player and position the text assuming the player is always in first person. However, abilities that put you in third person and/or alter FoV will displace the text.

You will need an expression for the following 2 values:

  1. X_POS: The x coordinate of the onscreen position
  2. Y_POS: The y coordinate of the onscreen position

These expressions can be numbers, variables, or any other combination of values. Once you've determined the expressions, plug them into the action below:

actions
{
    Create In-World Text(
        Event Player, 
        Custom String("Text"), 
        Update Every Frame(
            Eye Position(Event Player) + 100 * (
            X_POS * World Vector Of(Right, Event Player, Rotation) + 
            (Y_POS - 0.200) * Direction From Angles(Horizontal Angle From Direction(Facing Direction Of(Event Player)), Vertical Angle From Direction(Facing Direction Of(Event Player)) - 90) + 
            3 * Facing Direction Of(Event Player))), 
        2, 
        Do Not Clip, 
        Visible To Position String and Color, 
        Color(White), 
        Default Visibility);
}

Once you've pasted in the action, you can change the other parameters of the text to your heart's content, such as the text, scale, color, and reevaluation. Keep in mind that position reevaluation must be on for the text to move with the player properly, so if you want a non-reevaluating expression for X_POS or Y_POS, wrap that expression in Evaluate Once.

Option 2: First person using Local Player

This option has the advantage of using only 1 text overall instead of 1 per player. Like Option 1, the text will be displaced by abilities that affect FoV or put the player in third person. Additionally, since it uses Local Player, it will (as of patch 1.59 at least) not be visible to spectators. Keep this in mind if you are making a mode that may be livestreamed or hosted in a large private lobby.

You will need an expression for the following 2 values:

  1. X_POS: The x coordinate of the onscreen position
  2. Y_POS: The y coordinate of the onscreen position

These expressions can be numbers, variables, or any other combination of values. Once you've determined the expressions, plug them into the action below. Make sure to place the action in a Global rule.

actions
{
    Create In-World Text(
        Local Player,
        Custom String("Text"),
        Update Every Frame(
            Eye Position(Local Player) + 100 * (
            X_POS * World Vector Of(Right, Local Player, Rotation) + 
            (Y_POS - 0.200) * Direction From Angles(Horizontal Angle From Direction(Facing Direction Of(Local Player)), Vertical Angle From Direction(Facing Direction Of(Local Player)) - 90) +
            3 * Facing Direction Of(Local Player))),
        2, 
        Do Not Clip, 
        Visible To Position String and Color, 
        Color(White), 
        Visible Never);
}

Once you've pasted in the action, you can change the other parameters of the text to your heart's content, such as the text, scale, color, and reevaluation. Keep in mind that position reevaluation must be on for the text to move with the player properly, so if you want a non-reevaluating expression for X_POS or Y_POS, wrap that expression in Evaluate Once.

Option 3: Third person or fixed camera using Event Player

Since this option uses Start Camera, it will not be affected by the player's FoV setting. However, certain abilities such as Wrecking Ball's rolling form and Soldier: 76's sprint will still affect FoV and displace these texts. This option uses one text per player and supports spectators.

You will need an expression for the following 4 values:

  1. X_POS: The x coordinate of the onscreen position
  2. Y_POS: The y coordinate of the onscreen position
  3. EYE: The expresison used in the Eye Position field of the Start Camera action
  4. LOOK: The expresison used in the Look At Position field of the Start Camera action

These expressions can be numbers, variables, or any other combination of values. Once you've determined the expressions, plug them into the action below.

actions
{
    Create In-World Text(
        Event Player, 
        Custom String("Text"), 
        Update Every Frame(
            EYE + 100 * (
            X_POS * Cross Product(Direction Towards(EYE, LOOK), Direction From Angles(Horizontal Angle From Direction(Direction Towards(EYE, LOOK)), Vertical Angle From Direction(Direction Towards(EYE, LOOK)) - 90)) + 
            (Y_POS - 0.200) * Direction From Angles(Horizontal Angle From Direction(Direction Towards(EYE, LOOK)), Vertical Angle From Direction(Direction Towards(EYE, LOOK)) - 90) + 
            3 * Direction Towards(EYE, LOOK))), 
        2, 
        Do Not Clip, 
        Visible To Position String and Color, 
        Color(White), 
        Default Visibility);
}

Once you've pasted in the action, you can change the other parameters of the text to your heart's content, such as the text, scale, color, and reevaluation. Keep in mind that position reevaluation must be on for the text to move with the player properly, so if you want a non-reevaluating expression for X_POS or Y_POS, wrap that expression in Evaluate Once.

Option 4: Third person or fixed camera using Local Player

Like Option 2, this option uses one text overall but is not visible to spectators as of patch 1.59. Like Option 3, the text will be displaced by abilities that affect FoV or put the player in third person.

You will need an expression for the following 4 values:

  1. X_POS: The x coordinate of the onscreen position
  2. Y_POS: The y coordinate of the onscreen position
  3. EYE: The expresison used in the Eye Position field of the Start Camera action, with any Event Players replaced by Local Player
  4. LOOK: The expresison used in the Look At Position field of the Start Camera action, with any Event Players replaced by Local Player

These expressions can be numbers, variables, or any other combination of values. Once you've determined the expressions, plug them into the action below. Make sure to place the action in a Global rule.

actions
{
    Create In-World Text(
        Local Player, 
        Custom String("Text"), 
        Update Every Frame(
            EYE + 100 * (
            X_POS * Cross Product(Direction Towards(EYE, LOOK), Direction From Angles(Horizontal Angle From Direction(Direction Towards(EYE, LOOK)), Vertical Angle From Direction(Direction Towards(EYE, LOOK)) - 90)) + 
            (Y_POS - 0.200) * Direction From Angles(Horizontal Angle From Direction(Direction Towards(EYE, LOOK)), Vertical Angle From Direction(Direction Towards(EYE, LOOK)) - 90) + 
            3 * Direction Towards(EYE, LOOK))), 
        2, 
        Do Not Clip, 
        Visible To Position String and Color, 
        Color(White), 
        Visible Never);
}

Once you've pasted in the action, you can change the other parameters of the text to your heart's content, such as the text, scale, color, and reevaluation. Keep in mind that position reevaluation must be on for the text to move with the player properly, so if you want a non-reevaluating expression for X_POS or Y_POS, wrap that expression in Evaluate Once.


Notes

  • Make sure that Clipping is set to Do Not Clip for the Create In-World Text action. This will ensure that the text is not obscured by map geometry or the player's first person viewmodel.
  • The values 100, 3, and 0.2 were determined by trial and error and are somewhat arbitrary. In some cases, if the player or camera is near the world boundary for Overwatch maps, the position expression may fail because the Workshop is trying to render texts outside the world boundary. In this case, you may need to change some of these values, which will also affect the scale of onscreen coordinates.

How it works

The actual math behind this is fairly straightforward. It essentially uses the player or camera's facing direction to determine the relative x and y axes of the player's screen, then places the text on a plane parallel to the screen. The position is determined by adding the following components:

  • The player or camera's eye position, which serves as starting point
  • A multiple of the player or camera's facing direction. This ensures that the plane the text is placed on is parallel with the player's screen but still visible.
  • The x coordinate of the desired screen position multiplied by the x axis of the player's screen. This is determined by using either World Vector Of(Right) for a player-based text or Cross Product(facing direction, y axis) for a camera-based text.
  • The y coordinate of the desired screen position multiplied by the y axis of the player's screen. This is determined by rotating the facing direction vector 90 degrees upward using Direction From Angles(horizontal angle of facing direction, vertical angle of facing direction - 90).

Note that the last 3 components are all multiplied by 100 in the above implementation. This places the text very far away in world space while keeping it in the same place onscreen. The idea is to reduce the effect of camera sway from walking or ability animations.

Theoretically, this same technique should be applicable to both Create In-World Progress Bar Text and Create Icon, though the math may be a little different. It should also work for effects and beam effects to place them relative to the player's screen, though they should not be placed far away like texts/icons, and certain effects will appear to rotate as the player turns.

Join the Workshop.codes Discord