How would I go about making an arm follow the cursor?

Basicly when your shooting I would want the arm to point where your shooting, I’ve googled this and saw a few posts similar, but they didn’t really help that much to me as a beginner to raycasting, which I figure it would be. If anyone can give any tips, ideas, even link a tutorial if there is any out there I somehow missed. Thanks in advance.

I think the most basic approach would be, creating a vector between a fixed point on screenspace (such as 0.5,0.5?) and mouse point. You can then define maximum rotation on x and y, then multiply these by the vector defined by mouse position and rotate the arm by these values.

Another solution would be, and much better if you also implemented targeting assisting, that you can detect which object the mouse pointer is on and create a trajectory from the gun (or whatever) to the mouse hit position and rotate the arm accordingly.
You can find solutions about how to detect points about finding the point on 3d world that the mouse is pointing to.
good luck!