Making a character point his gun at the mouse

I'm working on a side-view game (like Bionic Commando Rearmed or Trine, for example).

I have a fully rigged character with animations working etc..., a crosshair script that gives the position of the mouse on the screen (as a 2D plane), and a gun model

What I'm trying to do is to put a gun in my character's hands (it could be different guns, not just one) and make him aim at wherever the mouse is pointing.

Basically, the mouse pointing is working fine, but I have no idea how to get the guy to hold the gun and move his whole upper body and arms to aim at the desired location while he is walking or standing still.

First, you will need to create a Behaviour with handles to the Transforms of the shoulder, elbow, and wrist. You can manipulate these joints in the LateUpdate() event, which is invoked after animations have been applied.

The exact positions/rotations you need to compute for these joints are dependent on the constraints of your rig. There are several open-source Inverse Kinematics libraries you can reference for strategies, or you might get away with some simple heuristics based on the Law of Cosines. However, there's no one-size-fits-all solution.

Use this

http://unity3d.com/support/resources/unity-extensions/head-look-controller

Basically does what Max describes.