Fix T36190: Rigid Body bake to keyframes bakes wrong the rotations.

Make sure that quaternions are compatible.
This commit is contained in:
2014-01-17 20:08:08 +01:00
parent 09ce3c18ee
commit 377bb55566

View File

@@ -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()