Fantastic! How to add animation mixing in the game engine

Have you ever been annoyed, because you can’t mix actions in the game engine?

Like you want a character running and shooting at the same time. You asked for help and the answer was: “Not possible!” ?

[/INDENT][/INDENT]:ba: You don’t believe me???

:evilgrin:Don’t worry

It is true. I prepared a simple demo
channelTest2.blend (425 KB)
[/INDENT][/INDENT]It was prepared and tested with Blender 2.49b.

I want to know how it works? :yes:

Ok, it is a little more complex than the classic way.

What is the classic way?

  • create an action
  • pose your armature
  • set keyframes for the posed bones within this action
  • add an action actuator to the logic bricks with the name of the action.

Need a second action?
Do the same thing but store the poses within a second action.
Add a second action actuator to play the second action.

You want to play both? Oups, no way! Just one at the time! Even with priorities just one!

But Why?

The restriction is:

  • actions are played simultaneous when the actions do not share channels. A channel represent the pose for one bone.

But I want to animate all bones. That makes the character look cool :cool:! So how to do that?

Ok here is the solution:[INDENT][INDENT][INDENT]ARMATURE CONSTRAINTS[INDENT]Ahh… :confused: What?

[/INDENT][/INDENT][/INDENT][/INDENT]Yes, armature constraints. I found them by watching a really cool rigging video tutorial. Unfortunately I didn’t bookmarked the link :o. Maybe I can post the link later.

Anyway, there should be some tutorials out in the modelling forums (I haven’t checked that). But the good news is that the constraints work within the game engine. Even the IK contraint as long it solves to bones within the armature (cool for walk cycles:yes:).

The demo uses the action constraint. But you can use other constraints as well.

You can bind a complete action to one control bone. That means when you move the control bone, the contrainted bones play the according actions dependent on the control bone’s location (or rotation). So it act as a slider or level. I think the experienced blender animators already know this an use them a lot. It makes complex animation easy to be controlled.

The point is there is ONE channel playing ALL channels of an action.
So if you want to play a second action,you need just another control bone with its action constraint.

It is a little bit complicated to add all the constraints. You need a constraint for all bones of the played action. There is a helper:

  • Select the control bone,
  • <shift> select the action bone
  • Press <crtl>+<alt>+<c>
    Blender automatically sets up some of the constraints parameters for you.

Blah blah :mad:, HOW DOES IT WORK IN GE?

Set up ONE action with ONE channel (for the first control bone).
Then set up ONE action with ONE channel (for a second control bone).
And now you can play both actions simultaneous in the game engine :spin:.

The best is, you do not even need to remake your actions. You just need to add the constraints to bind the bones to the control bone. The action constraint need the name of the original action to be played.

Enough for know! Whoever is finding spelling mistakes (I’m sure there are a lot) can keep them :D.

As usual:
I hope it helps

By the way, the Demo is really really simple. If someone has a cool rigged character with two cool ,that should be mixed together (like running with empty hands and running and holding a box) post it here. We could make a nice demo.


This is very cool. Finally a way to do this. Thanks!

Ya, thanks a lot

I’m sorry that people said this wasn’t possible and that you had to find out the hard way, but you can also mix actions correctly the classic way (without the action constraints) by having channels only for specific bones in each action.
mixed_actions_test01.blend (421 KB)
The same applies to shape key actions.

But your solution may be better, thanks for sharing!

Another fantastic solution by Master Monster!
However as PhilB mentioned, I never thought it wasn’t possible! I learned it by animation in C4D! The system is almost the same! But I might be wrong! For instance,I never succeeded in using the same action, like forward 1-30 and backwards 30-1…
Thanks I’ll definitely use it!

That is the point: you can’t use the same bones.

With the constraints you can.

You can move the control bone from the high value to the low value and the action will be played reverse.

Yes it plays in reverse, but still can’t be used in reverse ! I must admit, I didn’t know how o use the action restriction! This is very useful, it’s like the key driver thingy in Maya! Now I really have a big grin in my face!
This means I can add detailed or complementary animation into a main one. If only we could use an object to control it instead of just bones…

Wait, so does this allow for proper(ish) animation blending? (IE 50% this animation, 30% that one, 20% the other one)
I’d test it out myself but I don’t have the time right now.

Unfortunatly only predefined influence (50% action A, 30% Action B, 20% current pose). I couldn’t find a way to change the influence during realtime. It is possible to keyframe the influence but I wasn’t able to use that keys.
Maybe someone has more luck and can show it to us.


Could please find that rigging tutorial you mentnioed previously?

You can blend, using properties to define the action position.

I will upload a blend in a sec

EDIT: Uploaded an example. One of the actions position is defined by a property, hold space to add to that property.


channelTest blend.blend (339 KB)

Just want to say I did what I was dreaming for long time with the help of this thread - 3d person setup when character arm is pointing at the gunsight when shooting. In essence I did sort of IK for several control bones on the arm. I will share it later when finish it. Perhaps with Ik in 2.50 it will be even easier to do.

So when people say this type of animation is not possible they’re only fooling themselves?

Amazing what most of us don’t even know about what’s possible in the BGE until someone finds a way.:spin:

If someone gives a feature request to Benoit, Dfelinto, or Campbell, then one may have to really make sure it isn’t already possible first.

I found the rigging tutorials:
see and the followup tutorials.

I hope it helps

Wow, this is very cool! Would you mind if I did an episode of “Bits of Blender” on this technique sometime?

Just take it. That’s why it is here. :smiley:

Cool, I’ll post this thread link if I do one. Thanks Prof :wink:

thanks, but I already knew that :stuck_out_tongue: I’ve run several tests quite a while ago…didn’t know hardly anybody knew about it…

Thanks for linking to this, it was kind of what I was looking for the other day when I made a topic.