   Interpolate animations
  Hi,Im having some problems with my animation code. I work with milkshape models.I load all the frames and if a dont use the interpolate code of the rotations it seems to work perfect (not fluid).Rotation[0] = mosisn->animations[anim].m_joint[j].m_pRotationKeyframes.m_parameter[0];  Rotation[1] = mosisn->animations[anim].m_joint[j].m_pRotationKeyframes.m_parameter[1];  Rotation[2] = mosisn->animations[anim].m_joint[j].m_pRotationKeyframes.m_parameter[2];But if i use the interpolate code it start to doing extrange movements. The interpolate code for the rotation is this:Rotation[0] = mosisn->animations[anim].m_joint[j].m_pRotationKeyframes.m_parameter[0] + fraction * (mosisn->animations[anim].m_joint[j].m_pRotationKeyframes.m_parameter[0] - mosisn-&gt;animations[anim].m_joint[j].m_pRotationKeyframes<span style="font-weight:bold;">.m_parameter[0]);  Rotation[1] = mosisn-&gt;animations[anim].m_joint[j].m_pRotationKeyframes<span style="font-weight:bold;">.m_parameter[1] + fraction *(mosisn-&gt;animations[anim].m_joint[j].m_pRotationKeyframes.m_parameter[1] - mosisn-&gt;animations[anim].m_joint[j].m_pRotationKeyframes<span style="font-weight:bold;">.m_parameter[1]);  Rotation[2] = mosisn-&gt;animations[anim].m_joint[j].m_pRotationKeyframes<span style="font-weight:bold;">.m_parameter[2] + fraction *  (mosisn-&gt;animations[anim].m_joint[j].m_pRotationKeyframes.m_parameter[2] - mosisn-&gt;animations[anim].m_joint[j].m_pRotationKeyframes<span style="font-weight:bold;">.m_parameter[2]);What im doing wrong?Thanks in advance.
  Ummm...what sort of rotation mechanism do you use? Cause if it is Quaternions, you can't interpolate them that way, you have to turn them into matrices and interpolate the matrices. I don't work with MilkShape, jus in case you didn't know.   ;  What is m_parameter? If it is a position, then your interpolation looks ok. However, make sure that i + 1 doesn't go past the end of the array.   ;  Is that a linear interpolation? If so, it looks a bit odd to me. Rather than:x = a + f * (b - a)perhaps it should be:x = (1 - f) * a + f * b...but I could be completely wrong. :)   ;  Hi,I dont use quaternions.m_paramater for rotation is m_rotation (x, y, z) for translation is m_translation (x, y ,z).I know that a i have to take care with the lasta frame but the error start at the beginning.The strange thing is that it seems to happend only for the legs. Arms and head seems to work perfect.I would think that i have loaded some data bad, but as i have told, it works perfect without interpolation.Sorry for my english.Thanks in advance.   ;  fro translation i think u might wana look at some curves like bezier or hermite interpolation.;  translation isnt the problem...for the moment...   ;  If the values are Euler angles, then you have these potential problems:Gimbal lock.You don't know the direction of rotation. Suppose frame i is 359° and frame i+1 is 1°. Should frame i+.05 be 0° or 180°?;  Thanks JohnBolton,I think that case 2 could be the problem.Anyone know how milkshape store the direction of the rotation?Thanks in advance.   ;  As far as I know it doesn't.  Just figure out which way would be the shorter path, and take that one.   