Mixing transforms
You have transforms that represent joints at two specific points in time. To make the model appear animated, you need to interpolate or mix between the transformation of these frames.
It's possible to interpolate between vectors and quaternions, the building blocks of a transform. So it's possible to interpolate between transforms as well. Instead of interpolation, this operation is typically called blend or mix. When mixing two transforms together, linearly interpolate the position, rotation, and scale of the input transforms.
Implement the mix
function in Transform.cpp
. Don't forget to declare the function in Transform.h
:
Transform mix(const Transform& a,const Transform& b,float t){ Â Â Â Â quat bRot = b.rotation; Â Â Â Â if (dot(a.rotation, bRot) < 0.0f) { Â Â Â Â Â Â Â Â bRot = -bRot; Â Â Â Â } Â Â Â Â return Transform( Â Â ...