Download

Tracking when an actor is hit via line trace (4.26.1)

Hi,

This may be a simple question but I’ve only begun using UE in the past few weeks. I was just curious to know if anybody had an idea how I could use the line tracing components within my first person character’s blueprints to show an interaction popup (widget) on screen. The actor is a button and I would only like the popup to show when the player is looking directly at it.

I’ve watched a few videos that have helped me to get a scene in which I can press “E” and activate a light using the button mentioned earlier ( here is the video for anyone interested : How to make an Interaction System in UE4 - Tutorial - YouTube ). Only problem was these videos emphasised the popup only being active when the character was inside of a box collider connected to the actor. I wanted a more direct interaction with the button so I changed the video’s blueprint so that a line trace would be refreshed every EventTick, but only active when something is hit AND the action button is pressed.

I’ve been stuck trying to figure this out for a few days now and none of the YouTube vids seem to cover this problem specifically.

Any help would be appreciated,

Thank you :slight_smile:

That collision box method has many pitfalls, don’t learn it :slight_smile:

( least being that you can interact with objects using your buttt )

If you’re going to do it properly with a line trace, you might as well learn about blueprint interfaces also: