Home Animation Showcase & Critiques

Rigging a flexible weapon bone

polycounter lvl 9
Offline / Send Message
Rmunday polycounter lvl 9
More of a technical question so if this is in the wrong place feel free to move it!

Lately I have struggled in both my own animations and client work to figure out how best to approach a flexible weapon attach bone that allows for grip changes, as well as independent rotation of the weapon to accommodate cool looking stuff! I have seen plenty of awesome animations on here and I am asking if someone could get me in the know on how best to go about it? I am by no means a rigger, generally falling back onto Rapid Rig to do the leg work. This however is something I cannot wrap my head around.

At the moment I am doing a character with a musket, the musket is part of the characters skeleton since the weapon will never change however lots of grip changes will be needed. Is it a case of the weapon is parented to the hand then using various locators on the weapon itself?

I am not looking for a lot of advanced switches or expressions just the basic knowledge of getting the bones in place and what constraints to use to best achieve what I am after. Since the weapon will be a part of the character skeleton I am just baking it as normal for UE4 so in engine should look exactly like in Maya, it is just overcoming this hurdle.

Any help is appreciated!

Replies

  • Obstfelder
    Offline / Send Message
    Obstfelder polycounter lvl 7
    I've made a setup like that. Basically I let the IK conrol for the hands follow the object in question and animate the position of the object.

    I have the IK control of the hands parented to a locator that has a transform constraint to the objects bone. That way I can animate the position of the hand freely even when it's attached to the object (this makes grip changes easier). I also have a separate control bone for rotating the object so I can spin it around while it's beeing held (and the hand won't spin with it).

    I made a short video that shows how the controls work:

    https://www.youtube.com/watch?v=BPiSWuU2-b8

    The reason I have the hands follow the object and not the object follow the hand is so the arc of the object will be easier to maintain with grip changes and switching hands.
  • Rmunday
    Offline / Send Message
    Rmunday polycounter lvl 9
    Thanks so much @Obstfelder so to reiterate the hand IK has a parent constraint to the locator. The locator is then position constrained to the weapons bone.

    Then there is another control on the weapon which then independently controls the object rotation? Does the weapon still only have the one bone correct?

    I am working in Maya but I imagine the principles are the same!
  • Obstfelder
    Offline / Send Message
    Obstfelder polycounter lvl 7
    I'm using a transform constraint not a parent constraint, but that's a preference thing, I'm guessing you could get pretty much the same result with a parent constraint. With the transform constraint I know that the IK control's parent will allways move exactly to the reference locator on the object.

    I only have one deform bone on the object, but it has two constraints that modify it's position. So the first one is the transform constraint that copies the position of the main control (this moves and rotates both the hand and the object together), and then there is a rotation constraint that copies the rotation from the controller that spins the object (this rotates only the object). both of those constraints are set to calculate in world space.


    It's been a few years since I worked in Maya, but the setup shouldn't work very differently there (most of the constraints have similar names). If anything, Maya has a bigger toolset than Blender for this sort of stuff.

    The one big difference between blender and Maya is that in Blender you use bone objects with deform turned off for controls and locators. It's a bit weird but that means you can keep everything inside of Blenders dedicated armature system which has some benefits. Anyway the point is that sometimes I tend to call something a reference bone (or point) but that would be a locator object in Maya terms.
  • KielFiggins
    Offline / Send Message
    KielFiggins polycounter lvl 8
    Hey Rmunday, weapons are particularly challenging in 3d, as I'm sure you've discovered.  I've played around with a lot of different solutions, but having it game ready adds a whole different level of complexity.  Below is a solution where the sword is pinned to either the world or shealth, and the sword drives the IK hand with the ability to adjust the grip.

    -create the sword at origin, so the blade handle is at the origin
    -create a nurbs curve called CTRL_Sword so that the pivot is also at origin
    -group CTRL_Sword, call it CTRL_Sword_Const
    -create a joint at origin, call it j_Sword, bind the sword to that joint and parent constrain j_Sword to CTRL_Sword
    -create another nurbs curve, called CTRL_Sword_Grip, parent this under CTRL_Sword
    -select CTRL_Sword, Modify > Add Attribute.  Long Name: toShealth, (*) integer, minimum 0, maximum 1, default 0
    -Windows > Node Editor > (hit tab to open a dialog and type 'reverse') to create a Reverse node, rename it shealth_REV
    -Create > Empty Group, call it rig_Sword_Global
    -select rig_Sword_Global then your shealth control then CTRL_Sword_Const and do a parent constraint without offset (the sword control will snap half way to the shealth)
    -select the parent constraint, set Interp Type to Shortest
    -select CTRL_Sword, Windows > General Editors > Connection Editor.  Select the parent constraint and click Reload Right.  Scroll to the bottom of the left column select toShealth.  Scroll to the bottom of the right column, select CTRL_ShealthW1.  Select shealth_REV node, click Reload Right, expand input, then click inputX.  Select shealth_REV, click reload left, select the parent constraint, click reload right.  Expand output in the left column, select outputX.  Scroll down in the right column and select rig_Sword_GlobalW0

    Now you can toggle the toShealth channel on CTRL_Sword and it will snap and follow the shealth or remain global.  

    From here, you'd want to repeat the steps of making a constraint, but instead, create a group above the IK control for your hand and constraining it to CTRL_Sword_Grip.  And instead of toShealth, create a toSword channel.  

    This setup will put the hand in sword space, allowing you to do various grip changes, but doesn't allow the sword to follow the arm, which is the trade off to prevent a cycle.

    Hope this helps, best of luck.
Sign In or Register to comment.