# Offset in Convert World Location to Screen Location

**URL:** <https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216>\
**Category:** Community & Industry Discussion\
**Tags:** world, space, position, conversion, unreal-engine, screen, question\
**Created:** [December 10, 2014, 8:04pm UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216 "2014-12-10T20:04:53Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![UFG\_02](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UFG\_02](https://forums.unrealengine.com/u/UFG_02)\
**Post date:** [December 10, 2014, 8:04pm UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/1 "2014-12-10T20:04:53Z")

</div>

There seems to be a strange bug on our designer’s machine (only) that causes the above convert function to report values that are offset up and to the left. We’re using this call to draw some reticle targeting widgets over some of our characters. They line up perfectly except on this one machine. Specifically the offset is (93, 153) pixels.

When we delete and resync the unreal Engine folder, the problem goes away…for a few days. It reared its head again today. This started when we upgraded to 4.6 (from 4.5), It ‘feels’ like there is stale data sitting around somewhere. It does NOT fix it when we only resync the project… must be the engine.

I’ve looked in the registry in case there’s some window dimension info stored there… but no luck. Any ideas? Is any of the data used in the projection or viewport matrices cached anywhere?

Thanks

---

<div class="post-metadata">

**Author:** ![Pierdek](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pierdek](https://forums.unrealengine.com/u/Pierdek)\
**Post date:** [December 10, 2014, 9:20pm UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/2 "2014-12-10T21:20:31Z")

</div>

Check differences in config files, “your module”/Saved/Config/

---

<div class="post-metadata">

**Author:** ![UFG\_02](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UFG\_02](https://forums.unrealengine.com/u/UFG_02)\
**Post date:** [December 10, 2014, 11:07pm UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/3 "2014-12-10T23:07:46Z")

</div>

OK, thanks. If (when?) it happens again I’ll do a thorough comparison of those ini files.

---

<div class="post-metadata">

**Author:** ![UFG\_02](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UFG\_02](https://forums.unrealengine.com/u/UFG_02)\
**Post date:** [December 12, 2014, 2:44am UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/4 "2014-12-12T02:44:05Z")

</div>

Well, it started happening on my machine today! Funny how it got a bit more attention cuz of this 😉 Here’s what I found: The file Engine/Saved/Config/Windows/EditorGameAgnostic.ini was causing the problem. A _good_ file looked something like this:

```
[/Script/UnrealEd.EditorGameAgnosticSettings]
RecentlyOpenedProjectFiles=D:/BLABLA/dev-unreal.4.6/BLABLA/BLABLA.uproject
bCopyStarterContentPreference=True
AutoScalabilityWorkScaleAmount=1.000000

```

while a _bad_ file had this added:

```
[/Script/IntroTutorials.TutorialStateSettings]
TutorialsProgress=(Tutorial=/Engine/Tutorial/Basics/LevelEditorAttract.LevelEditorAttract_C,CurrentStage=0,bUserDismissed=False)

[EngineBenchmarkResult]
Valid=True
ResolutionQuality=71
ViewDistanceQuality=1
AntiAliasingQuality=1
ShadowQuality=1
PostProcessQuality=1
TextureQuality=1
EffectsQuality=1

[ScalabilityGroups]
sg.ResolutionQuality=71
sg.ViewDistanceQuality=1
sg.AntiAliasingQuality=1
sg.ShadowQuality=1
sg.PostProcessQuality=1
sg.TextureQuality=1
sg.EffectsQuality=1

```

---

<div class="post-metadata">

**Author:** ![gormed](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gormed](https://forums.unrealengine.com/u/gormed)\
**Post date:** [December 12, 2014, 5:42pm UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/5 "2014-12-12T17:42:09Z")

</div>

Hey, just had the same problem (or something similar).

If you are using UMG and not pure slate to draw, which i just assume here, you need to use ‘Set Position in Viewport’ instead of the ‘Render Translation/Transform’ function. Also make sure you do not use sth like a Overlay Node with centered align or other Panels that align your content, or at least use them wise.

Here is a forum post i stumbled upon: [UMG and dynamic positions][1]

 ![23824-wts_umg.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/1/a/c1a7026e98029a757f1d47cb788453acd78e8c7a.png)

---

<div class="post-metadata">

**Author:** ![UFG\_02](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UFG\_02](https://forums.unrealengine.com/u/UFG_02)\
**Post date:** [December 13, 2014, 3:04am UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/6 "2014-12-13T03:04:30Z")

</div>

Hi gormed, thanks for the response. Turns out we are calling ‘Set Position in Viewport’. I’m pretty sure it’s the convert call. Luckily the .ini file has not reverted back to the borked version for us… knock on wood. When I manually set it, the problem returns.

---

<div class="post-metadata">

**Author:** ![fabs](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fabs](https://forums.unrealengine.com/u/fabs)\
**Post date:** [January 5, 2015, 3:21pm UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/7 "2015-01-05T15:21:36Z")

</div>

Me too now.

The HHDrawText pretty much just calls HUD::DrawText, and it’s seeing the offset as well. It does seem to be the WorldToScreen (i’ve never seen this working though, it’s always been offset.)  
When I check out where the thing is being rendered on screen, it does appear to be at the right pixel position accoding to the render call input. The values the world to screen function (bool APlayerController::ProjectWorldLocationToScreen(FVector WorldLocation, FVector2D& ScreenLocation) const  
) retrurn, appear to be wrong.

 ![25644-getscreenposition.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/a/b/2ab320da4ea4ed80240fb4278b305b3381775247.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9d7112cd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9d7112cd](https://forums.unrealengine.com/u/anonymous_user_9d7112cd)\
**Post date:** [January 5, 2015, 7:00pm UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/8 "2015-01-05T19:00:55Z")

</div>

Anecdotally, one of our team members reported that when he resized the viewport window it fixed the issue. Strange that it would affect the non-‘selected viewport’ play options, but anyways.

–tri7 (was UFG 02)

---

<div class="post-metadata">

**Author:** ![DamirH](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/damirh/32/906591_2.png) [@DamirH](https://forums.unrealengine.com/u/DamirH)\
**Post date:** [January 8, 2015, 8:39am UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/9 "2015-01-08T08:39:31Z")

</div>

Heya,

I just started getting the same issue and with the same logic (targeting overlay). However, this is 4.6 and I cannot seem to find the .ini file you noted as being the cause. Nothing seems to fix it for me unfortunately.

EDIT:  
Found it. The scalability settings had my resolution set to 75% (auto detect).

---

<div class="post-metadata">

**Author:** ![Denny](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Denny](https://forums.unrealengine.com/u/Denny)\
**Post date:** [January 8, 2015, 1:15pm UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/10 "2015-01-08T13:15:07Z")

</div>

We had the same issues when Resolution Scale is used in the Engine Scalability Settings. This is how we worked with the issue.

 ![26010-worldtoscreenoffsetissue.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/e/6/be6fea0596fe5ddecac3d9e0e683cb998041643a.jpeg)

---

<div class="post-metadata">

**Author:** ![fabs](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fabs](https://forums.unrealengine.com/u/fabs)\
**Post date:** [January 9, 2015, 4:58pm UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/11 "2015-01-09T16:58:33Z")

</div>

this seems to make things worse, not better, for me. Also, what’s screen percent? The offset I’m seeing appears to be non-linear. Mostly a constant offset, with some linear scaling as the object gets nearer, but also odd behaviour at the edge of vision.

---

<div class="post-metadata">

**Author:** ![Denny](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Denny](https://forums.unrealengine.com/u/Denny)\
**Post date:** [January 9, 2015, 5:10pm UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/12 "2015-01-09T17:10:18Z")

</div>

ScreenPercentage is another word for Resolution Scale. We fetched it via C++.

---

<div class="post-metadata">

**Author:** ![fabs](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fabs](https://forums.unrealengine.com/u/fabs)\
**Post date:** [January 30, 2015, 8:39am UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/13 "2015-01-30T08:39:22Z")

</div>

I fixed it for us, but it’s not something people will be able to use unless they have access to the engine source.

I modified this function:

```
bool FSceneView::ScreenToPixel(const FVector4& ScreenPoint,FVector2D& OutPixelLocation) const

```

the issue seems to be that the screentopixel is using the ViewRect, not the UnscaledViewRect. You can see later in the source that the `DeprojectFVector2D` uses the `UnscaledViewRect` over the `ViewRect`, so this looks like an oversight in updating all the code that uses ViewRect while adding the function:

```
void FSceneView::SetScaledViewRect(FIntRect InScaledViewRect)

```

Is this already fixed in 4.7? I don’t have access to the preview source.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9d7112cd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9d7112cd](https://forums.unrealengine.com/u/anonymous_user_9d7112cd)\
**Post date:** [February 11, 2015, 6:24pm UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/14 "2015-02-11T18:24:39Z")

</div>

fabs-ulous. I’ve made same change locally and can confirm it fixed it when using the borked ini file. Thanks.

---

<div class="post-metadata">

**Author:** ![Co](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Co](https://forums.unrealengine.com/u/Co)\
**Post date:** [April 1, 2015, 8:28am UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/15 "2015-04-01T08:28:32Z")

</div>

Thx fabs() your fix is working for us, the bug was still present in 4.7.3.

If any Epic STAFF member can have a look at this and validate/invalidate that it is a bug or a wanted behavior it would be fantastic.

---

<div class="post-metadata">

**Author:** ![hjeldin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@hjeldin](https://forums.unrealengine.com/u/hjeldin)\
**Post date:** [April 12, 2015, 4:34am UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/16 "2015-04-12T04:34:23Z")

</div>

The issue seems present in 4.7.5 too.

---

<div class="post-metadata">

**Author:** ![ABrookesy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ABrookesy](https://forums.unrealengine.com/u/ABrookesy)\
**Post date:** [January 10, 2021, 5:24am UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/17 "2021-01-10T05:24:28Z")

</div>

Can confirm this works for me - the screen resolution offset appears to be the main culprit:

 ![326836-screenshot-2021-01-10-152406.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/c/3/cc30a0546835637961af1a174b78470af0084430.png)

---

<div class="post-metadata">

**Author:** ![sbseltzer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sbseltzer/32/1200007_2.png) [@sbseltzer](https://forums.unrealengine.com/u/sbseltzer)\
**Post date:** [July 5, 2025, 4:58am UTC](https://forums.unrealengine.com/t/offset-in-convert-world-location-to-screen-location/301216/18 "2025-07-05T04:58:40Z")

</div>

Sorry to resurrect but I was facing this same issue in Slate/C++ on UE 5.5 and translating your BP logic to C++ actually worked in my case!

```c++
		FVector2D ViewportSize;
		ViewportClient->GetViewportSize(ViewportSize);
		float ViewportScale = GetDefault<UUserInterfaceSettings>()->GetDPIScaleBasedOnSize(FIntPoint(FMath::TruncToInt32(ViewportSize.X), FMath::TruncToInt32(ViewportSize.Y)));
		ScreenPosition /= ViewportScale;

```

The `ScreenPosition` variable from above was the result from `UGameplayStatics::ProjectWorldToScreen`.
