Game scale different than viewport scale?

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:

/

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!

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.

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.

I just tried using the camera’s fov:

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

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 :slight_smile:

(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…

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

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! :slight_smile:

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.

Get ViewPort Size

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?