blender 计算bvh运动轨迹备忘

简单设定动画

import bpy
C = bpy.context

positions = (0,0,0),(0,0,0.1),(0,0,0.3),(0,0,0.5)
frame_num = 0

for p in positions:
    C.scene.frame_set(frame_num)
    C.active_object.location = p
    C.active_object.keyframe_insert(data_path="location")
    frame_num += 1

FK在pos模式下的运动轨迹

import bpy
C = bpy.context
D = bpy.data

armature = D.objects['short']
target = 'mixamorig:LeftFoot'
for i in range(1,20):
    C.scene.frame_set(i)
    C.active_object.location = armature.pose.bones[target].matrix.translation
    C.active_object.rotation_euler = armature.pose.bones[target].matrix.to_euler('XYZ')
    C.active_object.scale = armature.pose.bones[target].matrix.to_scale()
    C.active_object.keyframe_insert(data_path="location")
    C.active_object.keyframe_insert(data_path="rotation_euler")
    C.active_object.keyframe_insert(data_path="scale")

C.scene.frame_set(0)

你可能感兴趣的:(blender 计算bvh运动轨迹备忘)