How to combine mecanim and script based bone movement/animations?

Hi guys,

I am strugling with a challenge for with I can’t find a reasonable approach, even after reading tons of posts. It has to do with animating my blender created player model with mecanim and script based bone movement and all of this in a network game using RPC.

I have the impression that there are various approaches to solve this, though none of them seems to match my situation. So I’d be very glad about some hints from the experts!

I’ve created my character model in blender 2.65 and rigged/animated it in blender. I’ve imported it successfully into my game and added a mecanim based animator for controlling and animating the basic movements (fwd, back, strafe left/right etc.). As a result, each of them is playing/blending nicely the correct animations from the blender model. This works great both as a single player and in network/multiplayer mode via RPC.

So far so good.

But now I am stuck in trying to add/mix additional bone movements (like looking up/down or crouching etc., by modifying the spine bone’s rotation). These movements should be controlled by player input (mouse axes) instead of by the animation itself, and smoothly blend into them.

I’ve learned so far from the forums that this is a commonly known challenge, because the blender animations usually claim full control over the bones, thus blocking any additional mouse induced movement/rotation.
But this can usually be solved by using LateUpdate() instead of Update() for applying the additional (player controlled) bone transform modifications.

So am using LateUpdate() now, and it works fine - but only as long as I am in single player mode.

In network mode however, where I am broadcasting the spine bone rotation changes over RPC, the other players’ models are always nastily “flapping” and “snapping” like crazy between the standard (animation based) and additional (player controlled) positions/rotations.

I am sure that this is (logically!) because the “competing” changes induced both by the animation and by the LateUpdate() function are always somewhat laggy via RPC. In single player mode, this lag is probably just too small for being noticeable, whereas in network mode, it’s too big to be neglected.

That’s why I need another solution for it. In other words: I need to find a way of really blending my different bone modifications, instead of just overriding one with the other in the LateUpdate() every frame.

So, after some more research, I found that such a thing might be solved by using the animation.AddMixingTransform function (e.g. here: But this does’t seem to be possible for me, because that function requires an animation component. And as I have animated my character with mecanim, I don’t have animation components, only an animator component.

So I am quite confused about which way to go, e.g.:

  • Is there any way to use
    AddMixingTransform event with my
    mecanim animator?
  • Should I rather give up mecanim and
    use animation components instead?
  • Is there any other solution for my
    basic problem that I’ve just missed?

Thanks for any help!
Hoping I am not the only one cracking his head over this… :slight_smile:

Just wanted to let everyone know that I’ve sorted out this issue, thanks to other people’s help.
Please see this thread for details and follow the comments by Owen Reynolds:

Solution summarized:

The problem turned out to be a simple and logical one, related to (natural) lag over RPC: You need to store the most recently known rotation value and ensure that any remote clone of the player model applies this recent value at least once per frame (to be done easily within the LateUpdate() function). This ensures that the animation cannot make the bone snap back whenever an RPC call should be missing or late.

hi, I think that the simpler way to implement additive animations is to add a new animation layer in your mecanim state machine.
In the (Late)Update function you can countinue to check the behavior to have in different states of each animation layer.
It’s fully explained in mecanim tutorial on youtube.