Download

UMG Drag/Drop Widget Overlap

Trying to get drag/drop working in the context of a slot-based inventory system a’la Diablo, and I noticed there doesn’t seem to be any events for detecting widget “collision” or overlap.

I can successfully create a DragDropOperation, and detect OnDragEnter in a target widget, but this is based on the mouse position.

If I’m using a Drag Visual to represent the drag (ie: an item’s icon), that widget is substantially larger than the mouse cursor. Is there any way to have the Drag events trigger based on the geometry of the Drag Visual?

Basically when the region of the Visual begins or ends overlapping another region, such as an inventory slot, I’d like to be able to detect that. Is it possible?

Failing that, how would I go about implementing that myself…is it possible in BP, or would I need to drop down to Slate and figure out how to do it there?

You’d need to modify the cursor properties when drag begins to adjust the cursor radius, this is only doable in C++, the Slate Application, Cursor. You won’t be able to achieve collision detection using the exact geometry, but the cursor radius could be used as an approximation.