Download

(How To) Trigger from line trace after overlapping for a set time?

I have a line trace that triggers an event if hitting a certain object. That is working fine. But I want it to only trigger the event if the character looks at that object for 2 seconds. If the character looks away, the trigger should cancel. I can’t seem to figure it out. Any ideas out there?

  1. Create a Blueprint class of the object that you want to look at for 2 seconds. I called mine ‘BOX_BP’.

1.png

  1. Inside your Player Blueprint class, create 2 float variables called “Delta Time” and “Look Timer” and follow the picture below. Hope this helps :slight_smile:

View Image In Full-Size: 2.png&d=1483710891

(To get the Break Hit Result node, if you drag out from the Line Trace By Channel “Out Hit” pin and at the bottom you’ll see Break Hit Result, click that :slight_smile: )