Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 WillyJenkins · May 27, 2013 at 09:38 PM · animationanimatormecanimroot motionlegacy

Using root motion scripting for specific animations

I have various animations from the asset store which I intend to use within my game, currently I am looking to introduce some combat stance animations. All my current general movement animations are within an animator using Mecanim and they all have root motion in-built, i.e. they have velocity and the animation causes the character to move across the map.

I have imported some new combat based animations which were originally set to Legacy, I changed them to Humanoid for use in the animator but they have no average velocity, i.e. they are in-place animations and don't make the character move. I understand that to make these move the character I need to attach a root motion script and call OnAnimatorMove to set the characters transform based on the animator parameters.

The problem I'm facing is that this affects all my animations, is there a way to only use this script for the specific in-place animations but use default root motion for all the others that work fine?

Thanks in advance.

Comment
Add comment · Show 1
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 moxiewhimsy · Apr 05, 2015 at 04:19 AM 0
Share

Did you ever get an answer for this? I was about to answer, then I noticed the date it was asked.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Wiki

Answer by moxiewhimsy · Apr 05, 2015 at 06:16 AM

One way to do this is to implement your own Root Motion handling script.

Start by figuring out which animations you want to use the built in root motion, and which you'd like scripted motion. You may wish to add curves to the animations you'd like scripted, to provide animation-matched data for use in your script, but this isn't always necessary.

Then implement an OnAnimatorMove() method in a component script with access to your Animator. Note: Once you do your object's Animator component will print "Handled by Script" in the Apply Root Motion field rather than allow you to toggle it via checkbox. Within the method, you can implement any scripted motion you like. For any built in root motion you'll need to grab it from the Animator (deltaPosition, and deltaRotation will be useful) and apply them directly to the root (Transform) of your animated object.

You can mix scripted and built-in root motion, but it may look very weird if you alter the interpretation of the built-in motion curves.

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

14 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

Related Questions

Can i use mecanim animator while using legacy? 1 Answer

How to fix this Mechanim root motion problem? 0 Answers

Moving Character to exact position using animation. 0 Answers

[Unity 4.3] Skinned legacy animations do not work 1 Answer

How to use mecanim to play specific animation clips when public static int condition is reached? 2 Answers


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