Weapon starts shaking when sphere trace barely touches obstacle

Hey, I’ve made function that makes chracter raise weapon when he’s too close to object, Problem is that when I turn my camera to something like wall corner and sphere trace barely touches it weapon starts shaking. It only happenss when obstacle is on the right side, when it’s on the left sidealt text weapon doesn’t shake. How can I fix it?

Video: 2021 09 18 - YouTube