You could implement slerp function:
import math
def quaternionSlerp(a, b, t):
cos = quaternionDot(a, b)
if cos < 0.0:
cos = quaternionDot(a, b.negateIt())
theta = math.acos(cos)
sin = math.sin(theta)
if sin > 0.001:
w1 = math.sin((1.0 - t) * theta) / sin
w2 = math.sin(t * theta) / sin
else:
w1 = 1.0 - t
w2 = t
aa = OpenMaya.MQuaternion(a)
bb = OpenMaya.MQuaternion(b)
aa.scaleIt(w1)
bb.scaleIt(w2)
return aa + bb
def quaternionDot(q1, q2):
return (q1.x * q2.x) + (q1.y * q2.y) + (q1.z * q2.z) + (q1.w * q2.w)