So I'm working on a character that carries a big gun, I've weighted the weapon to his right hand so it follows his hand/wrist movements but as the image shows I've got some serious clipping issues when he holds the gun or raises it to his shoulder. Is there any way to fix this? I was thinking it might be more of a case of how the gun is shaped.
I'm hoping that resolving that will help me with other issues like how the right hand doesn't follow the gun the way I want it to when I animate.
Replies
There are a few ways you can handle this but I will explain the ways I know. Firstly will this be intended for game engine use? If so the easiest solution in general is to have a "Weapon" bone on your actual characters rig, located at 0,0,0. Since this gun looks very simplistic a weapon rig won't be needed but for more complex modern gen weapons they would also have their own skeleton with a root, magazine bone, trigger bone and so on.
You then PARENT the weapons root bone or in this case just the weapon, to the characters weapon bone. Position the weapon using that weapon bone in the hands and then PARENT that weapon bone to the characters Right hand. This will give you a very basic attachment. This however can be rather limited.
The next step takes that basic system however adds a couple of extra steps into the mix to give you a more refined weapon handling system that can have the weapon rotate in the hands and be controlled while still following the right hand. I will try my best to explain it but I am not a rigger.
So, first thing you want to do like before is have a dedicated weapon bone (If its for game engine use) Otherwise just skip this step.
Then you want to create a locator or a null whatever they are called in what looks like Blender right? Once you have this locator (I will use locator since its what Maya uses and its easiest for me to word right!) you then need to select it and create a group with it. At this stage in the outliner it should be Group>Locator. Name the locator something along the lines of "Weapon_Adjustment". Then name the group its within to "HandAttach"
At this stage all of this should be done at 0,0,0 to keep things neat. Zero out the weapon again and Parent the weapon to the "Weapon_Adjustment" locator. Moving that around should now control the weapon. Then use the group to position the weapon within the hand. Once its where you want it, parent the GROUP to the R_Hand.
With this what you will have is the weapon following the hand, however using the "Weapon_Adjustment" locator you can also control its position and rotation within the hand. Some people like to take it one step further and within the group have 2 locators. One with a position constraint and one with a rotation constraint so you have more finite control of both.
For guns this is the basics. For 2 handed melee weapons and such it can get more complex than this. In general it always relies on a butt load of locators for things such as sliding hands up and down a staff. It really does depend on your needs at the end of it all.
Ping me if any of this is unclear I am always happy to throw together quick video of all this in action for you (Although I believe youtube could do the same thing )
EDIT: If you wishfor the R_Arm to use IK to follow the gun instead the process is the same accept when it comes to the hand. Parent the IK handle of the arm to the "HandAttach" group. Then use that group to drag the IK arm around.
Yes this is for a game, I'm creating one using Unreal Engine, so this is really helpful. I'll give it a go and see what I can do. Thank you so much for the advice and instructions
The gun in the image is just a stand in to get a basic idea of what the weapon would look like but I am working on a more detailed model, but this is an NPC so I was going to make it all just one piece with no moving parts (magazine, trigger, ect.). Would you suggest instead making moving parts for the gun?