lock-on targeting/sliding switch activation (proximity + look)

project: I am building a first-person puzzle game where the primary mechanic revolves around hitting sliding switches (I’ve created a sliding switch in blueprints that lerps along a vector from A to B, then after a delay slides backward to the original starting point). The sliding switches, when activated in the correct sequences, open doors.

goal: the switch should only be activated when the player is standing next to it, AND is looking at it. The satisfaction of these two conditions means the player is ‘locked on’, and the switch can be activated by button press. To indicate the switch is locked on, the switch material changes from white to red.

Here are screenshots of my player blueprint, which has the proximity/look code, and my sliding switch blueprint. I have the general interactivity working, but there are a few problems I’m hoping to get some help with.

1) Lock on lag/imprecision
When the player first approaches the switch, the system works well. He walks next to it, looks at it, the switch changes from white to red, and a button press activates the timeline that controls the lerp. But there is serious lag to get the system to work again immediately after. i.e. if he walks away, then returns, the ‘lock on’ does not register and it will often take 2-3 cycles of looking away/walking away, then returning, to get a lock on.

2) Lock on doesn’t disconnect
After the player locks on and activates the switch by button press, he can walk away and still push the button to activate the timeline that controls the lerp.

Any thoughts on how to solve these problems, or redesign my system to work better, are appreciated!

Solved problems with some boolean magic. For 1) I had the branch that was meant to check if sphereoverlapactors was overlapping the switch in the wrong place, for 2) I set up a boolean called IsActivated, check its value on activate, if false then activate the switch and set the value to true (if true, do nothing), then after the switch completes its sliding timeline, casts to my player character and sets IsActivated back to false.

Working much better now!