Getting 3d widgets to act as screen space widgets

I have widgets that need to be in world space. However, I want them to always stay the same size and have the same Y position in the viewport (for instance, in the top area of the viewport). The X position doesn’t matter - it will change based on the direction my character is facing. I’ve already been able to rotate the widgets to always face the player camera. I’m thinking that I’ll be needing to scale the widget component based on distance from my character, but i’m not sure how to go about keeping the widget component in the “top” area of the viewport.

Any input would be appreciated!
Thanks!

You can add widget component to your actor.
In details panel set:
Space to Screen, Widget Class to your widget and Draw Size set to your resolution (you can do this in BP too).
Open your widget and set anchors and position.

The space needs to be World, so unfortunately that won’t work :frowning:

Maybe I missed something, but you can achieve this with Space to Screen. It will be shown as 2D text, image or whatever in 3D space and will always face to camera.

What won’t work if you put Space to screen?

If I put it in Screen Space, then it won’t be occluded by the environement. I want trees/buildings/etc to be able to block the widget

Did you ever find a solution to this?

Not exactly what I wanted, but what I ended up doing was getting the distance between the player & the widget component and then using that number as the input value for “Map Range Unclamped” with ranges that I tweaked to make the ideal widget size. The number that was returned from the “Map Range Unclamped” is what I multiplied the scale of my widget component by (on tick). You could also use “Map Range Clamped” as well.

Usually, in other 3D programs, such requirement is solved very simply. Just make a camera to be parent of your widget. Move widget locally (usually in Z direction) in Unreal front would be X direction, so your widget is always in front of camera. Just adjust its distance from camera and its scale. That distance determines how large space will be for other object which can be in between your object and camera to occlude your widget. If widget can be put in camera space, that would be the same. Local X, is the offset from camera. So your widget “travel” with the camera in the scene, it is really in 3D scene space, but viewing from that cam, it looks like it is stick constant on the screen.
I guess, same can be applied in UE too