jimmay.10
(jimmay.10)
May 29, 2019, 1:41am
13
jdannenbring:
Super helpful, thanks! Didn’t think to do this when the drag ate all my mouse position info. Works like a charm. If, like me, the next person is simply looking for what 3D objects are under their mouse cursor while dragging:
1 - Override the Dragged event in your custom Drag&DropOp class (shown in Everynone’s example above)
2 - Pass the PointerEvent that the event Dragged contains off to your player controller or whichever class is handy.
3 - Process the PointerEvent with GetScreenSpacePosition (that gives you X/Y)
4 - Deproject Screen to World (that gives you World position/direction
5 - Use a LineTrace to see whats down there!
3a. Use the AbsoluteToViewport node to convert the desktop coordinates to pixel position in the screen before the deproject. Otherwise it works fine in fullscreen, but not so much in windows.
2 Likes