Screen Space to World Space

Hey there,

I’m trying to spawn a 3D object at the world coordinates of the position of a umg button (those two icons in the red circle), however all my attempts didn’t yield even a close result so far (they always spawn somewhere at (9, -1, 10) or something, it should be somewhere at (80, 120, 0) though).

I tried it with the ConvertMouseLocationToWorldSpace-node and also some GetMousePosition-node combinations. i also tried the GetHitResultUnderFingerByChannel but this returns only (0, 0, 0), unless it hits solid geometry (like the egg in the center, which is at (550, 0, 0)). Then I tried to place a plane static mesh actor in the scene right in the xy-plane but as soon as I rotate that plane to fit the xy-plane no hit is detected anymore (besides that, if I press one of the umg buttons the result is the zero vector anyways).

So I think, what I basically need to do to spawn an object under the button is a ray-xy-plane-intersection. The ray needs to hit the screen coordinates of the button where it is pressed and then I have to calculate the intersection with the xy-plane. Unfortunately I didn’t find anything useful so far to achieve this.

Could you give me a hint please?

Kind Regards,


Add this to your code.

Thank you for your answer. It still doesn’t work, though. Now the result is (0, 0, 0) no matter where I click :-/

Are you clicking on mesh or something visible? or you are clicking just on space? It’s important.

I’m clicking on the button and then a 3D object should spawn right where I have clicked

Hi there,

I could solve the problem by adding another trace channel and a blocking volume that represents the xy-plane. It works great on PC, however, the GetMousePosition-node I use is substituted by a GetInputTouchState-node on Android, which means that the x and y values in that node are not updated when I press a button. Therefore, only the non-umg-location I’ve pressed last is stored in those values, which leads to obscure spawn locations.

Is there anything like GetMousePosition that works both on PC and Android?

Thank you