🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

[Mecanim] Mixing translational rootMotion and scripted rotation in OnAnimatorMove?

Started by
-1 comments, last by Ender1618 8 years, 11 months ago

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

This topic is closed to new replies.

Advertisement