Struggling with Screen location to World Position


I’m having difficulty trying to spawn actors at specific location on screen.

I’m working in 2D and I would like to spawn the actor on the left side of the screen.

I’ve used ConvertScreenLocationToWorldSpace and set X and Y to 0.

If I spawn the actor (blue square) at the returned location it appears in the middle rather than left of screen.

Can someone explain how I can spawn something in world space and have it aligned left,right top bottom of screen?

Couldn’t get the ConvertScreenLocationToWorldSpace to work as I needed but then realised I didn’t need to do this anyway.

I was working with orthographic camera width 500 with the camera located at 0,0,0. Because of this the left side of the screen was at -250 in Y direction.

So to get the actor (blue square in above example) to spawn on left of screen I simply needed to set location to 0,-250,0 . May need to add offset amount if origin/pivot point is not on left of mesh.

Just thought I’d give an update incase useful for someone who missed the obvious like I did.

As a note about ConvertScreenLocationToWorldSpace, the World Location it returns is actually the location of the camera, and you then add the World Direction (multiplied by something to make the ray longer) to cast a ray in world space.

However, as you said, this is not necessary with an orthographic camera, but that does explain why your actor would appear at the center of the screen.