Third Person Action RPG Lock On Question - Distance Lock Off Bug

This is how I enter my lock on function:

ToggleWeapon is the keyboard action to try a lock-on. ForceLockonToggle is a custom event that will fire when something happens to force you toggle your lockon. This can happen, like in your case, if you are too far away from your target or if you are blocked by LoS or if your target dies or is removed. It sets your weapon active state to the opposite of its current state, then goes down the branch to see if it should turn it on or off.

Here is my disable lock-on function:


003a335ba332044e80a96896a929bec900a16f8e.png
https://forums.unrealengine.com/core/image/gif;base64

That custom event could be called on a check that happens every tick, every few ticks, etc. You can change the tick rate of an actor manually as well, if you are worried about performance, but I’ve yet to see any kind of performance dip at all, so I haven’t tried using anything like a timeline for that. It is useful though for the sake of game feel, if you broke LoS for only one tick and it unlocked it would be pretty annoying. I split my tick into two branches, one for calculations done while locked on and one for calculations done while not locked on. I haven’t really touched this project in a bit so it is kinda messy, apologies for that