Tracing beneath HUD element / Crosshair
I'm trying to get a trace of all objects beneath a large, circular crosshair element on the HUD, but I don't know how to go about it. The goal is to have the player smart-target anything inside this large crosshair.
My first thought would be to do a shape-trace, but this wouldn't account for depth; the shape effectively gets smaller the further out it goes, and wouldn't be able to match the crosshair.
I also considered performing a series of line traces out from under the crosshair, but that would leave a lot of gaps for smaller objects to slip by.
I could combine ConvertWorldLocationtoScreenLocation with GetActorBounds to see if an object's bounding box overlaps the crosshair, but then I would need some way to reference each object on screen anyway. Since running that each frame on every object in the level would be beyond inefficient.
Is there some way to grab any object which falls within a certain space on the screen?
Never used this node but it seems to be doing what you're after.
However, I don't think it's going to work for a circular shape as it's clearly designed to cater for RTS style rectangle selection. If you're versed in c++, consider taking it apart and see what makes it tick. Perhaps you can adopt it to your needs.
answered Apr 14 '18 at 07:25 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here