diff options
author | Sergej Reich <sergej.reich@googlemail.com> | 2014-01-17 23:08:08 +0400 |
---|---|---|
committer | Sergej Reich <sergej.reich@googlemail.com> | 2014-01-17 23:09:59 +0400 |
commit | 377bb55566366b65c7bd71df3fdd935f8f3b4b26 (patch) | |
tree | af20a2986632194917b44abe31b7adf9fd4703a7 /release/scripts/startup/bl_operators | |
parent | 09ce3c18ee70cfc99e36351518095ea6b70a6837 (diff) |
Fix T36190: Rigid Body bake to keyframes bakes wrong the rotations.
Make sure that quaternions are compatible.
Diffstat (limited to 'release/scripts/startup/bl_operators')
-rw-r--r-- | release/scripts/startup/bl_operators/rigidbody.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py index e28d4284b6e..c1c73ffd419 100644 --- a/release/scripts/startup/bl_operators/rigidbody.py +++ b/release/scripts/startup/bl_operators/rigidbody.py @@ -145,7 +145,13 @@ class BakeToKeyframes(Operator): rot_mode = obj.rotation_mode if rot_mode == 'QUATERNION': - obj.rotation_quaternion = mat.to_quaternion() + q1 = obj.rotation_quaternion + q2 = mat.to_quaternion() + # make quaternion compatible with the previous one + if (q1.dot(q2) < 0): + obj.rotation_quaternion = -q2 + else: + obj.rotation_quaternion = q2 elif rot_mode == 'AXIS_ANGLE': # this is a little roundabout but there's no better way right now aa = mat.to_quaternion().to_axis_angle() |