Download

Get Hit Result Under Cursor By Channel not working

Hey guys, i’ve been having a really weird problem lately that I cant seem to figure out.

I have a function on my Player Controller called Drag, this takes a drag target (Set in a seperate function) and gets a hit result under the cursor looking for a grid space (Trace channel, GridSystem, each space is assigned GridSpace which blocks that channel) and then sets the object’s position to that grid space.

The issue, is I took this original apporach from my OnDragDetected UI functionality, as I have a list of items that can be dragged into the scene and then placed on the grid. This uses the LineTraceByChannel and uses the pointer event to Get Last Screen Space Position, convert it from Absolute to Viewport, Deproject Screen To World and put those positions/directions into the LineTraceByChannel.

I have implemented a feature that allows you to press and hold the LMB to pickup a grid object, but when picking up and assigning the drag target through this, the LineTraceChannel apporach no longer works, but GetHitResultUnderCursorByChannel does, but when I call Drag through the UI Drag, GetHitResultUnderCursorByChannel doesnt work, but LineTraceChannel does! Infuriating!

I want to have just 1 drag function that handles dragging objects around, but cant seem to figure out why it wont work. Any help?