Is there a reason we’re box tracing on Tick for ? I understand that you may need it for something else but it seems redundant here. Do tell, perhaps I’m missing the point.
Why not approach it from the event-based side of things, as suggested above. Besides that, there’s a couple of unknowns in your script:
- are we sure velocity can be used (does the owner have a movement component - probably, but we can’t tell from the pic)
- why not use Trace Start / End for direction since we have it and want to rely on it (you understand what it’s supposed to do here, surely!)
- the up vector should be the enemy’s up vector, not yours - may be irrelevant but we have no clue how things work / rotate in your game. If you look at the snippet I posted, you’ll notice it’s from the enemy’s point of view.
Consider the following:
- in the player
- and results in:
- and the debug, if you’re into that kind of thing:
Apologies if I missed something critical discussed earlier on.