I am trying to have character motion controlled by a mix of RootMotion for translation and code for rotation, and I am having difficulty.
Like so:
[source]
void OnAnimatorMove()
{
if(m_CurDeltaAngle != 0)
{ transform.rotation = Quaternion.Euler(Vector3.up * m_CurDeltaAngle); }
if(m_CurTranslSpeed != 0)
{ transform.position = m_Animator.rootPosition; }
}
[/source]
Now as long a transform. rotation is never set (in the function), m_Animator.rootPosition is updated with the correct value. But once m_CurDeltaAngle != 0 and transform.rotation assigned to, from then on Animator.rootPosition is never updated (neither is Animator.deltaPosition). The character now turns in place correctly but does not translate.
Why would this be? What could I be doing wrong? Can anyone suggest another way of achieving this mix of using tranlational motion from root, but rotation from code?
I need to do this because I have a rather large animation set that has plenty of translation movement for locomotion animations, but no turning animations.
Thx,
-Ryan