mocap dae import is offset -13 in Y

I animated this guy in Unity with cinema-suite.com’s kinect software. He loads at 0,0,0 but on animate jumps -13 y and -1 x, anybody
know how to make him start at 0,0,0? His ‘dot’ remains at 0,0,0. Using 2.69

https://dl.dropboxusercontent.com/u/102638093/saunter.zip
1mb

Attachments


Your animation is offset.

If you look at z loc fcurves for the HIP bone you will see this. (image)

*Image Below shows x and y… later I noticed you had rot x = 90 and scale = 0.1, hence moving z.

To correct,

select the frame you want to be at 0,0

select the hip in pose mode, and note its z location. It’s around 138 at frame 1, not 13 since the animation is scaled to match the scale of the armature.

In the graph editor, select the z loc and move it to zero. To move it down use gy-138

Currently I’m working on a number of scripts to use with bvh files.

Here is a test script to rescale the animation and apply scale to rig.


import bpy




def rescale(rig, action):
    axes = [0, 1, 2]
    for axis in axes:
        scale_factor = rig.scale[axis]
        # get all the coord points that are locs
        cos = [kp.co for f in action.fcurves if f.array_index == axis and f.data_path.endswith('location') for kp in f.keyframe_points ]
        for co in cos:
            co[1] *= scale_factor
    bpy.ops.object.transform_apply(scale=True)




class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"


    @classmethod
    def poll(cls, context):
        return context.active_object is not None


    def execute(self, context):
        rig = context.object
        action = rig.animation_data.action
        rescale(rig, action)
        return {'FINISHED'}




def register():
    bpy.utils.register_class(SimpleOperator)




def unregister():
    bpy.utils.unregister_class(SimpleOperator)




if __name__ == "__main__":
    register()


    # test call
    bpy.ops.object.simple_operator()

I suggest you use the global scale factor when you import bvh. Non unit scales can be a real hassle later down the line.

Attachments