Event delay on pointing

Hi,

I want to activate an event after a short time looking at a specific object in my scene.

For now I’ve got a Print String function that displays the object i’m looking at :

What I’m looking for is to add a delay (p.e. 2 secs) before the objects name is displayed. I’ve added a Delay function : between Event Tick and LineTrace, the target is only “searched” once in 2 secs ; between LineTrace and Print String, the name of the targeted object is only displayed once each 2 secs.
What I want exactly is to display the name of the object I just targeted for 2 secs. If I change my target in these 2 seconds, nothing will be displayed.

Bonus question : how to change the crosshair displayed in the Hud during these 2 seconds to see if it’s working correctly ?

Thanks a lot !

HI!

If you use FP Template open FirsPersonHUD blueprint and add float variable attached to alpha componet of color Tint. Set defult value to 0. Crosshair will be not visible.

In this example, after press fire, crosshair appear, and after 2 second, appear text. Then, after next 1 second, crosshair disappears.

Some update there :
I added a Branche that checks condition of the LineTrace out boolean value (if it hits an actor or not), and a delay after.
When the camera targets an actor, it’s name is displayed after the delay duration.

Also i’ve changed the final function (displaying the name) for a more ponctual event (SpawnEmitteratLocation, with a particle explosion). When I target an object, an explosion appears at it’s location, an nothing appears more until the function is resetted (looking at “nothing”). I think it’s not the good method though. When looking at 2 objects side-by-side, the event does’nt detect the change and doesn’t reset the emitter function.

Does anybody have an idea how to do this a way more efficient ?

Thanks a lot for these examples !
I am currently using the FPTemplate.
I’ll try to adapt your example to my needs.
And what about displaying another crosshair (or texture) instead of making it disappear using alpha ? Should I create a new HUD display event ?

Default crosshair Red Cross, after press fire - Unreal 4 Logo.

■■■■’… it looks so simple like that !
Thanks a lot !