AI navigates too close to corners for shooting

I’ve implemented basic AI chase and shooting using behavior trees and EQS: find a shooting spot using EQS query to find a place around player with successful visibility trace, move until player is seen, then stop, focus and pull trigger until player is not visible anymore.

The problem is that around corners AI sometimes switch to shooting mode in position when player is visible, but enemy’s weapon in still blocked by corner. Is there a well-known approach to avoid that?

I’m newbie in UE, so the only idea I came up with is to produce some heatmap in order to keep enemy further from obstacles and corners, but this looks like over-engineering.

Thanks in advance!

Try to send traces from the weapon muzzle instead of the character. Place socket where your gun has muzzle and use this location as start point for traces.