Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 Prefab · May 06, 2016 at 05:48 AM · movementmecanimdistancestep

How to control step distance for root motion (Mecanim) animations?

I have become quite comfortable with the legacy animation system and will now be making my first attempt at the mecanim way of doing things.

One of my first issues while using root motion is getting a consistent step distance or overall movement speed for characters of different scales. For example, the player avatar will have slightly customizable size (scale). Also the enemy characters will have a script attached which will randomly choose a size (within a range), so that all of the enemies are not the exact same size by default. With root motion however, the larger characters have a larger step distance and therefore move faster than the smaller ones.

I would like to be able to control this, similar to how in the legacy system you can set a specific speed. For example, if I need all characters irrespective of size to move at the same speed, or the larger characters may need to move slower than the smaller ones since they are more heavy.

Apart from changing the animation speed, is there a setting in the animation properties or a way to do this via script in mecanim?

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
0
Best Answer

Answer by Prefab · Jul 03, 2016 at 05:23 AM

Based on my research it looks like that the only way to do the above at the moment is to set the specific animation to loop in place, and then override the root motion via script. This can also be used for other distance based animations such as jumps, dodges etc in which you need precise control over the distance traveled, or if this distance needs to change at runtime (based on stats for example). Here is the link to the documentation that covers this: http://docs.unity3d.com/Manual/ScriptingRootMotion.html

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
avatar image
1

Answer by Nazirzadeh · May 06, 2016 at 11:43 AM

If your problem appears after resizing the objects: You should add your original gameObjects(Avatar,...) as a child of an empty game object. Then change the size of the parent gameObject. In this way everything should work fine.

Comment
Add comment · Show 3 · 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 Prefab · May 06, 2016 at 02:06 PM 0
Share

I am not quite sure how parenting a character to an empty should change the distance of each character's walk step, or the overall walk speed. I have tried what you suggested and it makes no difference as far as I can see. Could you please explain this some more.

avatar image Nazirzadeh Prefab · May 06, 2016 at 03:12 PM 0
Share

Oh, Sorry you can reduce the speed of playing animation in Unity3D or you shoud try procedural animation in Unity3D.

I prefer to solve this kinds of problems in maya or other tools by animateing each character based on its size and desired speed.

avatar image Prefab Nazirzadeh · May 07, 2016 at 01:55 AM 0
Share

Yeah, unfortunately because the player size will be user customizable there are too many variations to try to resolve this at the modelling level. I have tried adjusting the animation speed in proportion to changes in character size, but visually this ends up looking a little silly. I may have to simply keep using legacy animation ins$$anonymous$$d.

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

49 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

Related Questions

focusing on a unit during unit detection in an RTS 1 Answer

Stopping navmesh agent next to the enemy 0 Answers

Rigidbody slows down before touching its target 1 Answer

Help with Animator has not been initialized error 5 Answers

rotate Y axis to face mouse 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