Jump to content
  • Advertisement
Sign in to follow this  
Ender1618

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

This topic is 1189 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Edited by Ender1618

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!