# World Space to Screen Space Function is wrong off bottom of screen

**URL:** <https://forums.unrealengine.com/t/world-space-to-screen-space-function-is-wrong-off-bottom-of-screen/1793949>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [April 8, 2024, 1:21pm UTC](https://forums.unrealengine.com/t/world-space-to-screen-space-function-is-wrong-off-bottom-of-screen/1793949 "2024-04-08T13:21:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![daveSchoneveld](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/daveschoneveld/32/726691_2.png) [@daveSchoneveld](https://forums.unrealengine.com/u/daveSchoneveld)\
**Post date:** [April 8, 2024, 1:21pm UTC](https://forums.unrealengine.com/t/world-space-to-screen-space-function-is-wrong-off-bottom-of-screen/1793949/1 "2024-04-08T13:21:00Z")

</div>

Confirming Bug “Project World to Screen” (but all the world to screen space functions) the math is wrong off bottom of screen. I wouldn’t be surprised if this is a bug left in a lot of games. The math is correct for the left, right, top. All those work as expected, but off the bottom the position seems to be exponential off.  
The issue is the same with whatever world to screen function you use.

 ![BlueprintUIWorldToScreen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/e/3/de3d474bbbaf3045a6d46795f46b1a9db4a96d7c.png)

alternate version

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/2/4/124d0550d064ff3bb07329482153effb80c8f7c7.png)

Here’s a video demonstrating the issue

[![]( " - YouTube") ](https://www.youtube.com/watch?v=mtQXn6yw4Dc)

I’ve tested it more ways than this with the same results.

---

<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:** [April 8, 2024, 1:29pm UTC](https://forums.unrealengine.com/t/world-space-to-screen-space-function-is-wrong-off-bottom-of-screen/1793949/2 "2024-04-08T13:29:35Z")

</div>

It seems the widget is offset internally somehow. Check the hierarchy and see what is responsible for its desired size - we can’t see it here. You will need to base the calculation on **half** the desired size, as in:

> [@UMG Widget: Stay on screen - But how?](https://forums.unrealengine.com/t/umg-widget-stay-on-screen-but-how/123044/5):
>
> while there’s half a dozen ways to implement this, the gist is to subtract half the widget size from the viewport size and use it as a clamp: vid: [https://i.gyazo.com/7e60baa21a0fbe5e5796d81524b27671.mp4](https://i.gyazo.com/7e60baa21a0fbe5e5796d81524b27671.mp4)

---

<div class="post-metadata">

**Author:** ![daveSchoneveld](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/daveschoneveld/32/726691_2.png) [@daveSchoneveld](https://forums.unrealengine.com/u/daveSchoneveld)\
**Post date:** [April 8, 2024, 2:01pm UTC](https://forums.unrealengine.com/t/world-space-to-screen-space-function-is-wrong-off-bottom-of-screen/1793949/3 "2024-04-08T14:01:51Z")

</div>

> [@Everynone](#):
>
> Check the hierarchy and see what is responsible for its desired size - we can’t see it here. You will need to base th

How does the desired size play into the bottoms screen position? I thought that was just for clamping max values  
The widget is

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/7/7/47722a39a6c2cb5c610f3b662e5af18bb5e51af2.png)

---

<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:** [April 8, 2024, 2:03pm UTC](https://forums.unrealengine.com/t/world-space-to-screen-space-function-is-wrong-off-bottom-of-screen/1793949/4 "2024-04-08T14:03:47Z")

</div>

When you place a widget in the screen, you use its upper left corner. This looks fine, I was half expecting an extra canvas and some anchors. Replace this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/f/1/5f10023c80db95e04fb36e9588964ea02c51c483.png)

with Desired Size \* 0.5, see if it behaves.

---

<div class="post-metadata">

**Author:** ![daveSchoneveld](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/daveschoneveld/32/726691_2.png) [@daveSchoneveld](https://forums.unrealengine.com/u/daveSchoneveld)\
**Post date:** [April 8, 2024, 6:29pm UTC](https://forums.unrealengine.com/t/world-space-to-screen-space-function-is-wrong-off-bottom-of-screen/1793949/5 "2024-04-08T18:29:48Z")

</div>

Thanks. Well that works for the top example, the second test case has a different calculation but all that doesn’t matter for the core issue. The clamp is only stopping it from going off screen, not fixing the math in its position offscreen.
