# How to attach a 3D widget to bottom of screen

**URL:** <https://forums.unrealengine.com/t/how-to-attach-a-3d-widget-to-bottom-of-screen/472801>\
**Category:** Cinematics & Media\
**Tags:** screen-position, unreal-engine, Widget, Blueprint, question\
**Created:** [October 12, 2020, 7:08am UTC](https://forums.unrealengine.com/t/how-to-attach-a-3d-widget-to-bottom-of-screen/472801 "2020-10-12T07:08:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![dylanvgames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dylanvgames](https://forums.unrealengine.com/u/dylanvgames)\
**Post date:** [October 12, 2020, 7:08am UTC](https://forums.unrealengine.com/t/how-to-attach-a-3d-widget-to-bottom-of-screen/472801/1 "2020-10-12T07:08:14Z")

</div>

In my proyect I have a 3D widget which is attached to the camera and the player can spawn objects on top of it by selecting one of it’s buttons. However, I would like the widget to always be attached to the bottom of the screen (the lower bezel if you will).

I’ve have noticed that at different screen sizes, the widget will not scale correctly and I do not know how to make it so that it keeps it’s relative scale and position according to the screen.

For example, what I would like to accomplish is for my widget to be anchored to the bottom of the screen and occupy X percentage in height and another X percentage in width no matter the screen size.  
Is there a way to accomplish this?

I think also a better question would be: Can I get the world position of the camera’s lower bound? that way I could anchor my widget to that position.

Here are a couple of screenshots, My widget is the thing with the greenish buttons.

This first one shows a small gap regarding the bottom of the screen

 ![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/b/c/abc00c7383d8582d8287e02dd9176fdb3efc9e5d.jpeg)

This one shows a huge gap with the bottom of the screen

 ![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/1/5/b155db08dfde8ed152834dc0e13cdf870ceacec8.png)

Here’s how it works:  
 ![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/a/e/8ae806bbcab569168b3b5c3cb678fa6058ef5e12.gif)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [October 12, 2020, 7:40am UTC](https://forums.unrealengine.com/t/how-to-attach-a-3d-widget-to-bottom-of-screen/472801/2 "2020-10-12T07:40:52Z")

</div>

Is there a reason you’re using a widget component for this? The whole point of having a component is that it _can_ move automatically, follow a world coordinate and scale accordingly.

If you want a menu at the bottom of the screen, anchor it to the bottom edge using a canvas - it’s the appropriate tool for that kind of thing.

Do tell if I misunderstood your intentions here, though.

* * *

edit: Here’s how anchoring works:

> **[Anchors](https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/UMG/UserGuide/Anchors/)**
>
> Using Anchors to keep UI Widgets in fixed locations based on different aspect ratios.

---

<div class="post-metadata">

**Author:** ![dylanvgames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dylanvgames](https://forums.unrealengine.com/u/dylanvgames)\
**Post date:** [October 12, 2020, 7:58am UTC](https://forums.unrealengine.com/t/how-to-attach-a-3d-widget-to-bottom-of-screen/472801/3 "2020-10-12T07:58:51Z")

</div>

Yes, please see my edited question at the end for a gif of how it works. Basically I want to spawn characters at the widget position which is something I’m already doing (don’t mind the clipping, I need to change the Z spawn pos). But I want this to happen in 3D, I want to be able to spawn these actors and in the future I’ll probably spawn particle effects and stuff like that. So as far as I know (which is not much) I can’t do that with a 2D widget, unless I replace the 3D models for textures but it’s not something I want.

It’s working fine, it’s just that I need to figure out how to position and size the widget or whatever I put there for aesthetic purposes

---

<div class="post-metadata">

**Author:** ![Hours](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hours](https://forums.unrealengine.com/u/Hours)\
**Post date:** [October 12, 2020, 8:36am UTC](https://forums.unrealengine.com/t/how-to-attach-a-3d-widget-to-bottom-of-screen/472801/4 "2020-10-12T08:36:04Z")

</div>

If its position remains relative to the screen then you do not want a Widget Component. You can do this all with a standard Widget.  
Use anchors, as Everynone said, and Deproject Screen to World can be used to translate the 2D Widget Space to a 3D World Location: [Deproject Screen to World | Unreal Engine Documentation](https://docs.unrealengine.com/en-US/BlueprintAPI/Utilities/DeprojectScreentoWorld/index.html)  
You may want to look into the ‘Scale Box’ Widget Layout as well.

If none of these are what you’re looking for then we’ll need some clarification.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [October 12, 2020, 8:44am UTC](https://forums.unrealengine.com/t/how-to-attach-a-3d-widget-to-bottom-of-screen/472801/5 "2020-10-12T08:44:28Z")

</div>

> I need to figure out how to position  
> and size the widget or whatever I put  
> there for aesthetic purposes

I actually do not know how to do it from the top of my head. It would require a matrix transform of sorts. One that takes screen ratio, current resolution and object screen size into account - the latter BPs have no access to, for example.

You could hack it if you know the size will be fixed but it won’t. 😑

> So as far as I know (which is not  
> much) I can’t do that with a 2D widget

You absolutely can do it:

[![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/9/1/c9121b3e402a1e304fd52aab6aaec0da0fe20d48.gif)](https://gyazo.com/c594b9abd77b2cdc73f2311ea7a9c256)

This is just a border.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [October 12, 2020, 9:09am UTC](https://forums.unrealengine.com/t/how-to-attach-a-3d-widget-to-bottom-of-screen/472801/6 "2020-10-12T09:09:25Z")

</div>

Here’s a quickie that may work for you, at least consider the following:

- a Spawnbar widget anchored to the bottom of the canvas

 ![318369-widget.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/4/2/342548a63057ca6f6e6b6a30a1e45a8a600f817e.jpeg)

- its widgets (border + sizebox) are in an array

 ![318370-spawn.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/3/a/e3ae4dec92399aa2ed3695abc7768d5886ded897.jpeg)

- the buttons detect clicks and fire off an _Event Dispatcher_

 ![318371-screenshot-2020-10-12-100029.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/8/2/38273a3655a9b0c7bb58925a63f3be110a68b119.jpeg)

- here in _Level Blueprint_ but this belongs in the _Player Controller_ or some kind of spawn manager

 ![318355-screenshot-2020-10-12-095907.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/a/9/ca90f870e4e9eb9073fcb8e32ad23284989ee1d5.jpeg)

- above, we catch the dispatched event, spawn what’s needed and drive it around by hitting geometry
- the moving around can be done in many, many ways and you already have a solution so definitely stick to what makes it logical / comfortable
- you could easily decide which buttons spawn what as the dispatcher can be loaded with data

* * *

Even though it may not be exactly what you’re after, perhaps it will inspire you:

[![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/c/5/3c541bf95b5b336891615677906a75e78192040d.gif)](https://gyazo.com/44d116721ff0893a4867c4556c63bdd7)

---

<div class="post-metadata">

**Author:** ![dylanvgames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dylanvgames](https://forums.unrealengine.com/u/dylanvgames)\
**Post date:** [October 12, 2020, 5:00pm UTC](https://forums.unrealengine.com/t/how-to-attach-a-3d-widget-to-bottom-of-screen/472801/7 "2020-10-12T17:00:27Z")

</div>

Sorry, I think there’s a confusion. My problem is not with actually spawning the actors and projecting the pointer to world space.

My problem is that I want the actors to actually be visible on top of the widget in the Z position when spawning them. Let’s say I also want to spawn a particle effect when the player clicks the button

![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/d/b/1dbbd0096bf45bcdbd4175d0befa8e3aebe8dc6f.gif)

If you see this gif, the actors are actually OVER the widget. In terms of functionality I’m already achieving what I wanted. I hope this makes it a little more clear, I think my question might be confusing and not representative of what I want to achieve.

I think we can generalize this question to How to anchor any actor to the bottom of the screen?  
Let’s say in 3D card games, where the cards appear always on the bottom of the screen, how do they detect that lower bound?

---

<div class="post-metadata">

**Author:** ![dylanvgames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dylanvgames](https://forums.unrealengine.com/u/dylanvgames)\
**Post date:** [October 12, 2020, 5:01pm UTC](https://forums.unrealengine.com/t/how-to-attach-a-3d-widget-to-bottom-of-screen/472801/8 "2020-10-12T17:01:44Z")

</div>

Thanks for the answer, I think my question might be confusing and not representative of what I want to achieve. I’ve answered Everynone’s latest comment with some more clarification, if that helps

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [October 12, 2020, 5:05pm UTC](https://forums.unrealengine.com/t/how-to-attach-a-3d-widget-to-bottom-of-screen/472801/9 "2020-10-12T17:05:21Z")

</div>

I see. Apologies for the misunderstanding.

* * *

Not sure how to solve this for all resolutions, aspect ratios and / or widget sizes. Widget components display their content on quads whose screenspace size will depend on many factors. Getting a screen space size of a 3d object is not exposed to BPs. And you will need this data for the calculations.

You’ll need to dig deeper into the engine. I had to do something similar a couple of times for aiming reticules and it wasn’t fun to work with. You can start with this perhaps:

[https://www.ue4community.wiki/legacy/get-screen-size-bounds-of-an-actor-3u16cs06](https://www.ue4community.wiki/legacy/get-screen-size-bounds-of-an-actor-3u16cs06)

This will give you the critical data for the screensize; you know the size of the widget component quad already. You would need to project it back to 2d while taking the camera frustum into account.

* * *

If there’s an easy way of achieving a perfect translation like this, I do not know it. It’s easy to do for a fixed size but seems like quite a challenge if you add just a handful of variables into the mix.

---

<div class="post-metadata">

**Author:** ![dylanvgames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dylanvgames](https://forums.unrealengine.com/u/dylanvgames)\
**Post date:** [October 12, 2020, 6:38pm UTC](https://forums.unrealengine.com/t/how-to-attach-a-3d-widget-to-bottom-of-screen/472801/10 "2020-10-12T18:38:11Z")

</div>

Thanks, I think that wil be enough to get me going.
