4
$\begingroup$

As you can see, the gun rotation for my IK rig behaves weirdly when rotating.
I'm not sure what the problem is. Here's a link to the blend file:

Also, maybe I'm overthinking this, but:
I've made the gun a "child of" the hand (bone constraint) so that I'm animating the arms only and exporting it to the game engine (attaching the gun to the arms rig in the engine afterward).

It actually works well when I make the hand a "child of" the gun and only animate the gun. Though, the problem with this approach is that I only animate the gun and would have to additionally export the arms' animation. So I guess the way I do it now is easier/faster because the only thing I really have to animate on the gun is the slide, and that's only for the shoot animation.

One thing I noticed:
When I change the vertex group assignment on the hand (to either the entire hand or only the palm), the guns´ rotation changes when rotating the hand. But still, it's not behaving like it should be.

enter image description here

$\endgroup$
0

1 Answer 1

3
$\begingroup$

Targetting the Gun_root's Child Of constraint to a mesh object's vertex group isn't going to work because the only information it will accurately get from this is a position offset. Rotation will be unpredictable.

A vertex group only stores geometry data, not the full transformation (location, rotation, scale) of a bone. Bones carry pose information that directly affects an object's position and rotation, while vertex groups only affect geometry assignment and don't properly inherit bone transformations, leading to unexpected behavior when animating the hand.

A better target would simply be the c_hand_ik.r bone.

enter image description here

The result will be way more normal:

enter image description here

It actually works well when I make the hand a "child of" the gun and only animate the gun. Though, the problem with this approach is that I only animate the gun and would have to additionally export the arms' animation. So I guess the way I do it now is easier/faster because the only thing I really have to animate on the gun is the slide, and that's only for the shoot animation.

Unless you do strictly nothing with the gun, you will always have to export the animation of both rigs, no matter what. And personally, I would probably never let the gun be perfectly still, there's always a bit of movement from the fingers, the gun itself, changes in the grip, ... It would feel very stiff if the gun is just stuck to the hand with nothing else. And on top of that, there are the gun parts that might move too. So I wouldn't really ever have "nothing" animating that rig, and thus would never escape the animation baking and exporting.

When it comes to the relationship direction, in theory (and assuming you do animate the gun), you can have the relationship made in either way:

  • Hand > Prop
  • Hand < Prop

What it will change is how you will animate and interact with the controllers to get what you want. The final results should be baked into keyframes and exported for both rigs regardless. So in practice, do whatever feels more comfortable and efficient to you. Which might change from one prop to another, from one animation to another, sometimes even within the same animation! (Child Of constraints can have their influence animated, so to dynamically change parents over time).


On a side-note:

You don't have a fixed point of attach, which means both in Blender and the engine, each time you parent the two, you will also have to then manually add an offset to position the gun correctly in the hand (on top of that you might have some animation which might change the required initial position from one animation to another).

You could have two bones for the whole gun: One which will be parented to your rig in game predictably (I.E a bone whose default position/rotation/scale is exactly the hand bone's), and one which is child of the formed and offsets the whole gun and will be actually the one carrying the whole gun's animation. But it's inevitably heavier.

Or you could have the whole gun rig world-centered, leave the gun root bone there and have the gun offset bone carry the offset up to the hand, this way in engine you just parent the gun rig to the character rig instead of the hand.

Both leave total freedom of the gun positioning to the animator.

You can of course keep things as they are right now and have the offset done manually in the game engine. It's up to you to see how you prefer to deal with this kind of problematic, and it also depends on how many other props and characters you have.

$\endgroup$
1
  • 1
    $\begingroup$ Wow! You're an absolute hero!! It's amazing how qualified this answer is. I now know exactly what I needed to know, plus really good advice on how to proceed with the workflow. Indeed, I needed a solution where I wouldn't need to place the prop manually in-engine because the slightest offset would be noticeable. I was looking all over the web for an explanation like this but couldn't find any. Thanks to you the web got smarter and I hope that this answer will help others as well as it helped me. Thank you very much for taking the time testing it and, most of all, explaining it so well :) $\endgroup$ Commented Feb 5 at 20:14

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.