How to code gun aim on 2d ragdoll

Hello, I wan to make my 2d character aim but stated in the heading my character is a ragdoll so the arm isn’t in a fixed position. I want to be able to aim my gun using my mouse, but the thing is a child of the players arm. How do i control the weapon arm using my mouse, Help will be appreciated thank you.