Fix T39886: Transformed parents of Rigid Bodies cause problems with Bake To Keyframes

Need to convert transforms to parent space for objects with parents.
This commit is contained in:
Sergej Reich 2014-04-25 05:26:48 +02:00
parent 3b75d6c4f9
commit 258e30f2c7
Notes: blender-bot 2023-02-14 10:44:57 +01:00
Referenced by issue #39886, Transformed parents of Rigid Bodies cause problems with Bake To Keyframes
1 changed files with 3 additions and 0 deletions

View File

@ -143,6 +143,9 @@ class BakeToKeyframes(Operator):
scene.frame_set(f)
for j, obj in enumerate(objects):
mat = bake[i][j]
# convert world space transform to parent space, so parented objects don't get offset after baking
if (obj.parent):
mat = obj.matrix_parent_inverse.inverted() * obj.parent.matrix_world.inverted() * mat
obj.location = mat.to_translation()