How To click on any object in viewport using Scriptable tools

I’m trying to select actors in the viewport using a custom Scriptable tools. I’m doing this using Line Trace By Channel but this is ignoring camera actors (and potentially actors in other channels depending on the project). Every line trace seems to filter objects in some way. Is it possible to line trace against everything in the map like the way it works when you’re in selection mode?

Hi Guillermo,

Unfortunately, line trace operates on collision tests and consequently are bound by collision channel constraints and whether the actors define collision. For instance the CameraProxyMeshComponent that defines the editor-only visual component of a camera actor is defined with the NoCollision profile. Selection mode operates differently using our hit proxy system that is not exposed to blueprint, so it is not readily accessible to Scriptable tools.

What are you looking to achieve in your scriptable tool that requires selection behavior similar to regular selection mode?

I have just started working with scriptable tools so I’m trying a few things. Right now I’m just trying to click on two points on the scene and get the distance between them, so this is currently not working if I want to get the distance between two cameras. Is it possible to expose the hit proxy system to blueprints through a blueprint function library?

Scriptable tools give you the ability to modify the way the user interacts with the viewport so I can see this feature being useful in lots of potential tools.

Ok yeah. I agree that it’d be generally useful to have a BP function to perform a raycast/frustum selection and return actor hit proxy data. I’ve logged a feature request for that item under the ticket UE-290923. Unfortunately I cannot promise any timelines on when this would be addressed. Let me know if I can be of further help. Cheers.

Thanks Lonnie. In the meantime, is there any way that I could expose hit proxy data to blueprints?

Sorry, I don’t have any good alternative solutions to suggest for accessing hit proxy data in blueprints.

How about c++?

In terms of C++, you could expose a delegate that listens to the USelection::SelectionChangedEvent to BP and then have your tool simply not capture any mouse clicks but listens to these editor selection changed events to monitor for selected actors that your tool could then process to compute your distance metrics.

Beyond that, I’m afraid I don’t have any better solutions to suggest short of implementing UE-290923.