Basically instead of having a Widget as the dragged visual, I want it to be an Actor since the objects I’m currently dropping are Furnitures. Is there a way to implement it? I’m thinking I can implement it here in the On Drag Detected Function but unsure how. Any help would be appreciated, thank you!
You cannot have an actor as a visual. But nothing stops you from spawning a furniture actor at this point and trace to position it (the visual widget can be invisible).
Check this out:
This can be made much simpler if you do not need a drag visual widget at all.
Pass Unhandled during onMouseDown → Spawn an actor and send its reference to the PC (or, better, call the PC and have it spawn actor from class) and start tracing.
The widget can use screen position to trace but it can be cumbersome at times. Better have the PC handle that.
One reason to do it in widget is when you need to drop the whole thing onto another widget. But that’s not what we want here judging by the description.
Hello again. Sorry for updating the post. I was looking into adding additional functionality on this one like whenever the dragged actor is overlapping another actor it won’t drop. I’m a bit confused if I put this inside the custom drag and drop operation during Event Dragged? Or I put this inside the Actor Blueprint with the Event ActorBeginOverlap. Thanks in advance for the help.
I can’t recall the details of what we’re doing here. Are we dragging an already spawned actor around and only drop it when the mouse buttons goes up?
Perhaps, during the drag, asking the dragged actor to:
is enough, and if the Last Index = -1, we do not drop.
If you need visual feedback, you can call it every frame, or use Begin / End overlap - or even dispatch those events so we do not burden every dragged actor with the same script.
There’s probably half a dozen ways to accomplish it:
How to approach it depends on the details / desired result and what is supposed to happen once we’re in a position preventing us from placing the actor.
Thanks for the quick reply! What we were doing before is dragging an actor from a widget and then spawning it. I followed the tutorial you made before, it was this one:
I was able to follow through it and it’s working perfectly. I will try to apply this first then get back to you. Thanks again!
Hello, I’m back. I followed your advice and added the Get Overlapping Actors Node. I added the node in my custom Drag and Drop operation. See the following image below:
Now my only issue with this one is that whenever the branch is set to true the actor being destroyed is the one already in the scene but I want the one I’m dragging to be the one destroyed or rather than being destroyed, is there a way to cancel the drag?