Script to insert keyframes on Armature

I’m trying to create an fcurve to insert keyframes on every frame for an armature that is animated during the BGE execution (not manually).

Basically what I want is to get to this



armature_example.blend (1.58 MB)
from a simple static armature by adding locrot keyframes (to the pose bones?) for every frame using a script executed with an always sensor.

For each frame I have all the positions and rotations for every single bone, how do I store this info as keyframes?

Thanks!

You may want to look at the BVH Importer that comes with Blender. It creates an animated armature from imported data. If you are running this from the GAME engine why not just turn on record animation and be done with it? Press P Key then ESC and you would have your f-curves.

Thanks!! The BHV importer had everything I needed. It was much simpler than I imagined.

The record animation option was giving me lots of problems (not recording everything, crashes, etc. )… but everything works perfectly now!