I’m trying to drag from a button to the world to spawn an actor.
I already have working logic for touching (everything uses a touches because the target device is mobile) on the actors and dragging them toil move them in the world. This works by setting the actor’s location to the X and Y location of a broken hit (get hit result under finger by channel)
My plan was to use the UI button’s on pressed event to spawn the new actor and set the dragging bool to be true, and then my other logic would take over and the new actor would follow under the finger until released.
The problem is that after pressing and dragging from the button, I don’t get any “hits” under the finger so the newly spawned object never moves. However, if I keep my finger down and drag the cursor out of the play in editor window onto the editor’s UI, then BACK into the play in editor window, all without lifting the mouse button (mouse simulating touch) then the newly spawned object will snap to the cursor and move in the desired way.
So I’m thinking it is some kind of focusing issue since everything starts with touching on a button instead of the world… Is there any way I can start getting world space location under the cursor in the middle of a touch event that originated over a HUD widget? Or is there a better way to implement this functionality?