How to hide a widget behind objects.

You should set the widget render space to “World” instead of “Screen”.
Further, if that doesn’t work, try to make an Actor BP with a widget in it so you can place it anywhere (while still setting render space to “World”).

I have made a widget floating above an actor head, but I can see it through walls. Wondering how to hide it behind walls, as shown in this image: Screenshot - be3bc1685e075ae946b5af27758a1d72 - Gyazo

If a widget is on screen space, it will ever be until its visibility is set to true. But in that case, you cannot achieve a result as in the image shown. You can just hide/unhide it.

What do you mean when you say it looks disgusting? Maybe you have to work a bit with the widget settings. Can you provide a screenshot of the “disgusting” result?

From my experience you have to do it this way.
Screen space means it will ever be on screen, don’t caring about objects.
World space means it will be placed in world and so it will be affected by world objects.

If you find another way let me know. If I will find another one I’ll let you know too.
In the meantime, if you want, you can provide a screenshot so I can try to see if you can improve your result.

But when I do it “world” it looks disgusting. Like a 3d object and not a widget.

It looks like an object instead of an image. Are you sure there is no way to do that? or you just dont know…

It’s getting pixelated when I get closer to it, it doesnt fit it’s size according to the distance the camera is from it.

No not like that, You see it’s like an object? The screen one is perfectly what I want, it looks different.

okay, thank you.

You want something like this:
(See the attachments)

Am I right?
What I’ve done here:

  1. Created a “IconWidget”
  2. Created an Actor BP with the IconWidget on it and render space set to World.
  3. Then with a line trace I decide to show or hide the Interaction icon
  4. With the same trace I rotate the Icon facing the camera.

If it gets pixelated it is probably related to the image you’re using.

Ok I understand what do you mean.
The problem is that if the widget is rendered in world space it is rendered on a mesh, so you’re right, it will looks like an object. In that case you probably have to play around with the material settings to achieve something like opacity etc.

Anyway, I’m pretty sure that if the widget isn’t on world space it will never be occluded or hidden by other meshes because the Screen render is outside of the world render.

You’re welcome. Hope I helped a bit!

I don’t mind the look of my enemy health bar on world view but the problem that I had with it is that it renders collision. So if I shoot the bar it affects enemy heath. So as a temporary fix I set it to screen, was searching how to solve rendering through walls but it looks like it’ll be easier to figure out how to remove widget collision

You could get the world location of the widget then line trace to the player character’s camera (with the render still on screen if you want to). If it connects, set the visibility of the widget to true, if not set visibility to false.

This works well. I’ve been using this to sort widgets’ Z for hundreds of objects at a time.

If this works, could you please mark this question as resolved by clicking the green tick under my answer? Thanks