How do i make the Line Tracer "forget"?

A new day a new question, I am trying to make a blueprint that enables me to open the windows in my level, at first, i used trigger volumes, and if i stood inside them and pressed a key, the window opened. However, i could open the window no matter where i was looking. Now i am using a Line tracer to determine what I am trying to open, the line tracer also has a “maximum distance” so i can completely get rid of the trigger volumes i used earlier. My problem is however that the line tracer remembers the last hit object, so if i press my interaction key and the tracer hits nothing, it acts as if it hit the last object i actually interacted with.

Here’s my blueprint:

If I failed to mention anything that needs to be mentioned, just tell me and I will provide more information asap.
Also, I do realize that a combination between this and the trigger volume close to solves my problem, but it still would make me able to look away from the window and close it once opened if nothing else is interacted with inbetween.

You might try to put a line trace on a tick and always check for what the player is looking at. So the trace goes out say 3 feet, and if it hits an object it checks if it is interactable and if so, gets the type of interaction, sets a bool, calls the pop up “Use whatever button to Interact with me text”, etc.

So basically you are always checking for interaction, and when you find something, then it unlocks whatever button you set.

You need to use a variable where you save the Hit Actor. You need to set it to NULL if you you don’t hit the Window.

So you SET the variable to the window after your Cast worked, and if your Cast fails, you SET it back to NULL (leave the SET empty). That should work :X

After that, you call your function and just use the variable for your input.

This unfortunately does not solve my problem, the line tracer still remembers what I am looking at if i where to walk away from the interactable object without hitting something else with the line tracer, just moving backwards for example. Even if the tracer is on tick, every time it hits nothing, it acts as if it hit the previous object again. If I for example print what the line tracer hit on each tick, it would print “None” when I start the game, if I then hit say my window, it would print “Window_x”. But if I now go back and aim lets say for the skybox, wich it most certainly can’t reach, it still prints “Window_x”. I hope I am getting my problem across as clearly as possible :slight_smile:

Worked like a charm! Thanks man!