[4.7] Mouse events broken at large distances

Mouse traces do not work passed 100,000 units.

I require the mouse to interact with large objects at a great distance (the camera zooms out to see the entirety of the map). Whenever the camera is farther than ~100,000 units from an actor, it can no longer interact with it.

From what I’ve seen, the PlayerController::GetHitResultAtScreenPosition limits the cursor line trace to 100000 units
We are using the launcher version of UE4 and the PlayerController::GetHitResultAtScreenPosition is not virtual.

Any help is appreciated!

Hi Grogger,

I’m investigating your issue and will post back here as soon as I have a suggestion.

Hi Grogger,

You are looking in the right place. The 100,000 value is hard-coded into the raytrace that is used for GetHitResultAtSceenPosition. This is just a limitation of the engine unless you are using the Source version.

-TJ

Hi TJ, thanks for the response.

Is this something we can expect to be remedied at any point? (Making it an editable variable perhaps?)

If not, is my only route to do my own traces for the cursor, or is there a more suitable alternative to your knowledge?

Edit: Is there a particular reason for this limitation? (ie. should I not be doing ray traces at such great distances)

Is this something we can expect to be remedied at any point? (Making it an editable variable perhaps?)

We currently don’t have plans to expose this value to blueprints, it may however be increased in a later build of the engine. I don’t know the game mechanics and features behind your game but generally the 100k cap isn’t an issue in most cases.

If not, is my only route to do my own traces for the cursor, or is there a more suitable alternative to your knowledge?

You could create your own trace system and set the value to whatever you need it to be. Have it start on mouse location and trace towards the forward vector of the camera.

Is there a particular reason for this limitation? (ie. should I not be doing ray traces at such great distances)

100k was determined to be more than most games needed the standard raytrace distance to be. This doesn’t necessarily mean that you shouldn’t trace a distance longer than this. Just keep in mind if Mouse Over Events are enable, this trace is performed on Tick.

Ok, thanks again TJ, I’ll go the route of doing my own mouse traces.