Interactive Animations for Games

All my animations and game objects retain the same location (0,0,0) and z rotation. That is, the root bone does not rotate, scale or move. I let code handle transforming and rotating (I’m not a fan of using root motion in Unity3d).

This was fine, but now I’ve run into a problem. There are certain animations in my game that really need to be animated together. For example, I have a chest with an opening animation and a player character with an open chest animation. In the past, I would have just triggered the ‘open chest’ animation at a certain point in the ‘player opening chest’ animation.

While this works for things like strike/hit reactions in combat, if I want the player’s hand to follow the lid of the chest exactly the entire time it’s opening, then I need to animate them both simultaneously.

I’ve tried to do this, but because the root bone is set to 0,0,0, the chest jumps to the same location as the player character when I press play -even when the chest is not in pose mode and is not selected.

I tried to get around this by removing all the location and z rotation data from the chest in the dope sheet. This work relatively well, however I now can’t get back to the bone view in the dope sheet. I can only see the rotation, location etc data and can’t see the position of the bones and the little diamond boxes.

I’m stuck. Could someone please give me some advice about the best way to animate ‘interactive animations’ for games using blender?

*EDIT: I’ve posted the dope sheet problem as a separate question

Have you tried creating both the character and the chest with their root bones at the same location in World Space? This could also be World 0,0,0 for ease. There is nothing to say that an object need be anywhere near to its root bone…

Just a quick thought - I have never used Blender for games, but this technique works for me in some of my animations.

Cheers, Clock.

I ended up giving my armatures a root bone and I made sure that every bone’s rotation and location ultimately inherits from that root bone. If I never save the rotation or location of the root bone during animations, then I can move and rotate the animated character however I like while it’s animating. Animation such as opening doors, shaking hands, pulling levers etc. are going to be a lot easier to do now. I rotate the agents so they are facing each other, position them so they are in the exact locations they are going to be in game, and then animate accordingly.

Is that what you meant?

Yes - it is a very good idea to have a root bone, particularly for characters, so you can manipulate the whole character easily and so IK targets are tied in space and therefore more manageable.

I am pleased that you have solved this.

Cheers, Clock.

Thank you :slight_smile: