I’m trying to make a drop and drop material system using UMG. I’m running into an issue when converting the mouse position from screenspace to worldspace when a widget is dropped on the screen. I’m using the results to run a linetrace from the sceen out into the world.
I don’t run into this issue when running the conversion on tick, only when using the “OnDrop” function. If I get the mouse position from the player controller, it just returns as 0,0.
If I use the position from the “pointer event” in the function, the direction seems to be wrong, no matter the maths I use, causing the line trace to go out at an unexpected angle.
Here’s the function: Screen to World attempts posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4
You can see all the different ways I’ve tried to get the projection to work but I’m having no luck.
Here’s the working blueprint from my pawn’s event graph: Screen to World attempts (B) posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4
This math doesn’t work inside the widget as previously mentioned, the “mouse position” just returns 0,0.
I’d appreciate any guidance on this.