Space Calculation problem please help

Hello,
i want to make a (leaning) ads with two bone ik i am at the point where its good when i start it but when i move my mouse left/right/up/down it starts to do circles so my calculation might be not correct. I’ll attach a video where you can see pretty much everything. The calculation is done in the event graph of my anim bp. It is basically: ads point of gun - rh_weapon socket. Now i just need to transform the value to another space i think
Example Video of my project:

p.s. i heard it could also work using quaternions idk