Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by _yash_kaushik_ · Sep 27, 2018 at 02:09 PM · animationrotationblenderroot motionanimation clip

How to do Turn animations with root motion (root bone rotations)?

I am stuck in a situation right now. I have made a character in blender and made some animation clips (Walk, Run, Idle, Turn Left 45) with root motion (moving the root bone).

I have managed to get Walk and Run working with root motion by using OnAnimatorMove() function but I cannot get my "Turn Left 45" to work properly. In "Turn Left 45" I rotate the root bone towards left 45 and animate the character turning towards left and the character stops at 45 degree. This is my animation.

But in Unity when I use this in game, the character does not turn (rotate) at all and it plays the animation while facing forward. Means it moves its legs and body according to the animation but does not turn at all, its rotation in game remains same. Why is it not turning with root bone. In walk and run animations the entire character is moving forward with root bone then why not in Turn Left 45.

Settings that I have used in all animation clips in Unity are as follows :-

Root Transform Rotation, Root Transform Position (Y), Root Transform Position (XZ) Based Upon = Original, in all three

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by _yash_kaushik_ · Oct 05, 2018 at 09:15 AM

Ok so if anyone looking for an answer for this then I have figured it out.

The reason why my character was not turning and only playing body and leg movement was because of this little guy :-

OnAnimatorMove()

Here's a thing about this guy, if you leave this function empty (do not write anything in this) even then it will override root motion. So in my case I only had translation (forward and backward, XZ movement) code in my OnAnimatorMove(). If you do not have proper Rotation code in this function then it will not allow your character to rotate at all even if you are playing a turn rotation that has root bone rotation in it. So have proper rotation and translation code inside this function and then play your animations, your animations should work fine.

Here's what my OnAnimatorMove now looks like :-

void OnAnimatorMove() { agent.velocity = anim.deltaPosition / Time.deltaTime;

 Quaternion lookRotation = Quaternion.LookRotation(agent.desiredVelocity);
             transform.rotation = Quaternion.RotateTowards(transform.rotation,
                 lookRotation, agent.angularSpeed * Time.deltaTime);

}

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image PlayingKarrde · May 05, 2019 at 01:36 AM 0
Share

This isn't really solving your problem though is it? You've just gone from wanting root motion to using the agent's desired velocity to drive your rotation. I mean I'm sure you're getting the result you need but you're not actually driving your root rotation by your animation here.

avatar image
0

Answer by StellarVeil · Nov 30, 2021 at 11:10 PM

Select animation’s import settings > Disable "Bake into pose", Set "Based upon" to "Body orientation".

Now you don't need extra rotation code just ensure you enable apply root motion in animator's inspector or through ApplyBuiltinRootMotion() calls in OnAnimatorMove() method. @PlayingKarrde

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

264 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Rotation in Animation Clip not rotating object 0 Answers

Generic root motion jitter? 0 Answers

Animation stops too early on all keyframes with apply root motion 1 Answer

Mecanim Root Motion Rotation - 180 degree turn. 2 Answers

Root Motion slowly veers off track 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges