UE2 - UT2kX WorldSpaceOverlays()

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Shadow_knight

Carpe diem!
Jan 29, 2008
51
0
6
Prague
I've created my own custom HUD that adds some information to the game. I spawn this HUD by the interaction class and I call its PostRender() function from interaction PostRender() function so I can write on the canvas without problems.

Now I need to use Draw3DLine() function which can only be called from WorldSpaceOverlays() function. The thing is that this WorldSpaceOverlays() function is NOT called in my custom HUD (spawned by the interaction). Is there some way how to trigger the function WorldSpaceOverlays() in my custom HUD, or do I have to set my HUD as the default HUD for the player (which is very undesirable for me, cause I want my HUD to be universal - for all the gametypes).

Thx for all the answers.

sk

Note: Function DrawCanvasLine() with WorldToScreen() are not the solution, cause I need to draw really a lot of information, that should be 3D in the map (some custom navigation points connections, visibility, etc.)
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
WorldSpaceOverlays() is only called for the HUD of a player (as specified via PlayerController.MyHud), and a player can have only one HUD. If you need to render lines from outside the actual game HUD because you have no control over the HUD (e.g. because you're writing a mutator, not a gametype), how about using the debug line drawing functions from the Actor class instead? DrawDebugLine/Sphere/Circle draw a line, sphere and circle for the next frame respectively, while DrawStayingDebugLine draws a line until ClearStayingDebugLines is called. Staying debug lines are shared globally among all actors, so they should probably really be restricted to debugging.
 

Shadow_knight

Carpe diem!
Jan 29, 2008
51
0
6
Prague
One more question...

I'll need to draw ~ 20 - 50 of these lines per frame - will this have any significant effect on the performance, or is it still "ok" (with the DrawDebugLine function)?
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
From what I can tell, debug lines have the same performance penalty as any other 3D lines. The advantage with them is, that they can be "scheduled for rendering" at any point before WorldSpaceOverlays() is called.