Download

GetHitResultUnderCursor not working? Possible solution!

I’ve just spent quite a while figuring out why in the world would not my GetHitResultUnderCursor function work when it had exactly the same parameters as my LineTrace function, which worked.

After looking into the source code, I found out it’s actually dependent on a “Trace Distance” member variable stored in the PlayerController:

Which is set relatively low by default. So if you ever run into your GetHitResultUnderCursor not working right with objects that are far away, you may need to bump this value up quite a bit.

This is imho a bit of an UX fail, because there’s no obvious information for the end user that the function of the node is dependent on this one obscure variable, especially if you call the function from other class than the PlayerController itself. It’d make more sense to have that distance float right in the node. It’s also a bit silly to assume user wants to do all the queries at the same distance I think :slight_smile:

Anyway, I hope this saves some time to someone :slight_smile: