# Game scale different than viewport scale?

**URL:** <https://forums.unrealengine.com/t/game-scale-different-than-viewport-scale/458195>\
**Category:** Blueprint\
**Tags:** transforming-actors, spawn-actor-from-cla, viewport, actor-location, unreal-engine, Blueprint, question\
**Created:** [November 8, 2019, 7:02pm UTC](https://forums.unrealengine.com/t/game-scale-different-than-viewport-scale/458195 "2019-11-08T19:02:08Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![TremendouslyWET](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TremendouslyWET](https://forums.unrealengine.com/u/TremendouslyWET)\
**Post date:** [November 8, 2019, 7:02pm UTC](https://forums.unrealengine.com/t/game-scale-different-than-viewport-scale/458195/1 "2019-11-08T19:02:08Z")

</div>

I have an actor being spawn via “spawn actor from class” at location 0,0,0.  
I want to move this actor to the top left of the screen.  
Based on what I read about the viewport, I attempted to implement as so:

 ![292016-viewport-size-to-vector.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/9/5/595789fdfdd2ac44326276a59ca1da1bf4ff141e.jpeg)

/

 ![292017-vec-to-transform-to-actor-spawn.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/8/6/c869e702eed9c092aaaf0caf86ac2beed030f29d.jpeg)

Unfortunately this transform does not spawn the actor within the viewport, which leads me to believe there is a “hidden” scale factor here.

If you know what is going on here please help me out!

---

<div class="post-metadata">

**Author:** ![DDemon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DDemon](https://forums.unrealengine.com/u/DDemon)\
**Post date:** [November 8, 2019, 7:22pm UTC](https://forums.unrealengine.com/t/game-scale-different-than-viewport-scale/458195/2 "2019-11-08T19:22:13Z")

</div>

There indeed something called DPI it’s (1 / ViewPortScale) you just multiply it by your wanted position, but in your case I think you just forgot to add camera actor location because DPI is indeed needed sometimes but it usually has a small difference and not something that will make your character not spawn on screen.

---

<div class="post-metadata">

**Author:** ![TremendouslyWET](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TremendouslyWET](https://forums.unrealengine.com/u/TremendouslyWET)\
**Post date:** [November 8, 2019, 8:07pm UTC](https://forums.unrealengine.com/t/game-scale-different-than-viewport-scale/458195/3 "2019-11-08T20:07:23Z")

</div>

The camera is set to spawn at 0,0 elsewhere with an arbitrary z value, (making a top-down setup) but why would the camera location matter? Is the viewport not the perspective of the camera?

Thank you for cluing me into DPI.

---

<div class="post-metadata">

**Author:** ![TremendouslyWET](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TremendouslyWET](https://forums.unrealengine.com/u/TremendouslyWET)\
**Post date:** [November 8, 2019, 8:33pm UTC](https://forums.unrealengine.com/t/game-scale-different-than-viewport-scale/458195/4 "2019-11-08T20:33:11Z")

</div>

I just tried using the camera’s fov:

 ![292019-fov-math.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/2/5/825939ebc6932b81a9cd930e8458abac99dff4ae.jpeg)

instead of “get viewport size” and it seems to work. I guess I just don’t understand what the “viewport” actually is…

---

<div class="post-metadata">

**Author:** ![mightyenigma](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mightyenigma](https://forums.unrealengine.com/u/mightyenigma)\
**Post date:** [November 8, 2019, 8:41pm UTC](https://forums.unrealengine.com/t/game-scale-different-than-viewport-scale/458195/5 "2019-11-08T20:41:37Z")

</div>

WOuldn’t it be easier and more accurate to project the 3d location onto the viewport? I believe there’s a BP node for that. But hey maybe your math does just fine 🙂

---

<div class="post-metadata">

**Author:** ![DDemon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DDemon](https://forums.unrealengine.com/u/DDemon)\
**Post date:** [November 8, 2019, 9:52pm UTC](https://forums.unrealengine.com/t/game-scale-different-than-viewport-scale/458195/6 "2019-11-08T21:52:51Z")

</div>

(ViewPort is the size of the screen in pixels) \* (ViewPort scale) = that is what viewport is it does not include the location of the screen in the world. Ps: don’t know why you using FOV but if it works for you then its all good…

---

<div class="post-metadata">

**Author:** ![TremendouslyWET](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TremendouslyWET](https://forums.unrealengine.com/u/TremendouslyWET)\
**Post date:** [November 10, 2019, 11:04pm UTC](https://forums.unrealengine.com/t/game-scale-different-than-viewport-scale/458195/7 "2019-11-10T23:04:37Z")

</div>

How would you go about getting the size of what the player can view?

---

<div class="post-metadata">

**Author:** ![TremendouslyWET](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TremendouslyWET](https://forums.unrealengine.com/u/TremendouslyWET)\
**Post date:** [November 10, 2019, 11:26pm UTC](https://forums.unrealengine.com/t/game-scale-different-than-viewport-scale/458195/8 "2019-11-10T23:26:01Z")

</div>

It seems you are talking about the “Project” node: “Transforms a 3d world-space vector into 2d screen coordinates”  
If so a quick explanation on what the input vector is, would be very helpful! 🙂

---

<div class="post-metadata">

**Author:** ![ThompsonN13](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ThompsonN13](https://forums.unrealengine.com/u/ThompsonN13)\
**Post date:** [November 10, 2019, 11:52pm UTC](https://forums.unrealengine.com/t/game-scale-different-than-viewport-scale/458195/9 "2019-11-10T23:52:58Z")

</div>

wouldn’t it be the other way around, project screen to world. for example you have a known screen location you want the spawn so you would need to get the location in the world that corresponds to that screen position. if thats the case then you would need to deproject screen to world.

below is a example that spawns things (draws arrow) in the world based on a screen location.

 ![292129-capture.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/c/f/ccf6b6ddf332febd54df6b8d73459d15d2e2ec7f.jpeg)

---

<div class="post-metadata">

**Author:** ![DDemon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DDemon](https://forums.unrealengine.com/u/DDemon)\
**Post date:** [November 11, 2019, 6:22am UTC](https://forums.unrealengine.com/t/game-scale-different-than-viewport-scale/458195/10 "2019-11-11T06:22:13Z")

</div>

Get ViewPort Size

---

<div class="post-metadata">

**Author:** ![TremendouslyWET](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TremendouslyWET](https://forums.unrealengine.com/u/TremendouslyWET)\
**Post date:** [November 11, 2019, 6:06pm UTC](https://forums.unrealengine.com/t/game-scale-different-than-viewport-scale/458195/11 "2019-11-11T18:06:19Z")

</div>

Thank you so much! I never would have thought to look for “deproject”  
However I am now running into a different problem: It doesn’t spawn the actor on the edge of the screen (when using the vector undivided), as if UE4 thinks the viewport is smaller than it actually is…? Any idea what could be causing that?
