Blending an "On the Fly" Character Animation

Hello to all,

My question regards a non-standard use of Unity:
I have a motion capture hardware/software that is able to generate character animation keyframes in run-time.
I wonder if there is a possibility to create an animation in Unity that will behave according to keyframes that are provided in run-time. This would probably involve writing a native plug-in. But still, I don’t know how to represent such animation in Unity so I will be able to use with its animation system.

I’ve already seen the methods described for procedural animations. However, they are not good for me as it seems that procedural animations are performed only after animations update so it override bone transform and doesn’t gain all animation system advantages (such as blending).

I really wish that the “on the fly” motion capture could be somehow represented as an animation that I could blend with other regular character animations.

Does anybody have an idea on how to perform this?

I see two problems here:

  1. How to import these mo-cap poses/animation in runtime: I think it should be possible using C# scripts at least in native applications (I’m not certain about WebPlayer).
  2. How to blend them with other animations: I think “procedural animation” is the correct approach. You will have just one pose/animation coming per frame, right? so if you want to blend it in/out you could just use some blend factor when overriding regular animation in LateUpdate. In theory I think you could create an animation with just two keyframes, then add it to animation system and modify the animation in runtime, but I think that would lead you to more problems than you really want to, so I would go for procedural approach instead.