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: http://answers.unity3d.com/questions/126368/how-to-rotate-a-bone-during-an-animation.html). 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… 