3
$\begingroup$

I have a first person rig with a gun, but I need it to reload, my question is, can I have the magazine be attached to the gun, then when I need it to, attach to the left hand to be re-attached to the gun later?

$\endgroup$
1
1
$\begingroup$

Yes. Instead of actually parenting the bone, you use two Child of Constraints and use their Influence values to choose which one is being used.

Here's an example with just three bones to show how it works:

Three bones

Enter Pose mode, select the child bone, (in your case, the magazine) and add the two constraints.

Here's the constraint setup for the example:

The constraint setup

In your case, one parent would be the left hand, and the other would be the gun. It doesn't matter which order you pick them in.

The technique you use to swap parents is to set keyframes on the influence property of the two constraints. When the influence is 1, the child is constrained to be parented by that bone. So you want The first constraint to be 1 and the second constraint to be 0 if you want the child to follow Parent A, and the first 0 while the second is 1, if you want the child to follow Parent A.

You can set keyframes on the influence. But rather than having to keyframe both constraints, you can use a driver:

  • hover over the Influence input of the first constraint, and click Right mouse
  • Select Copy as new driver from the popup

selecting copy as new driver

  • hover over the Influence input of the second constraint, and click Right mouse.
  • Select Paste Driver from the popup

paste new driver

  • hover over the Influence input of the second constraint, and click Right mouse.
  • select Edit Driver. This will bring up a popup like this:

driver editor window

  • Change the type to Scripted Expression
  • Set the expression to 1.0 - influence

edited driver

  • click Update dependencies

Now you can simply set the influence of the first constraint to 0 or 1 and the driver will set the second to 1 or 0.

$\endgroup$
1
  • $\begingroup$ Wow! Very descriptive, I'll give this a shot, not 100% sure if it will work in what I am doing since I'm modifying an exisiting animation in a game. I'll hopefully get back to you if this works soon. $\endgroup$
    – Stanlyhalo
    Oct 23 '21 at 3:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.