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 /
  • Help Room /
avatar image
0
Question by Okplayback · Aug 10, 2016 at 04:52 PM · animationmecanimanimator controller

Move player by animation or script?

HI All, can somebody help me with question? I trying to create a mecanim system for character and now can't choose better case - how to move my player in space? By script changing transform, or by aminations with root motions? p.s. sorry for terrible english)

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

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by theANMATOR2b · Aug 11, 2016 at 02:11 PM

Blockquote

When developing games root motions for the avatar is never used , animations are only for moving the different skeleton parts in its place but the actual displacement in space is done using scripts. What will happen if root motion was used - when the animation will end and start again the avatar will go back to the same position where it started from.

Blockquote

Root motion is used quite often actually. In mecanim if the animations have root motion - on the animations tab check 'loop' to avoid the character snapping back to origin. If the animations do not have root motion - use code mentioned above - OR you can generate root motion if desired. Check the learning information under the animation section for guidance on generating root motion.

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 Okplayback · Aug 11, 2016 at 02:25 PM 0
Share

Okay, so, what way is better? Using root motion in mecanim, or move player by script?

avatar image theANMATOR2b Okplayback · Aug 11, 2016 at 04:48 PM 0
Share

There is no "better" way.

It's up to you how you want to proceed. As an artist - I prefer root motion. Working with programmers - they usually prefer to translate characters via code.

Benefit of using root motion - no foot sliding (reduced foot sliding), easier for animator to create animations that involve root motion, ins$$anonymous$$d of requiring root motion to be removed, easier for 2 character interactions (imo).

Benefit of using code - less user interfacing with mecanim, different/more control over transitions, ?? others - can use non-root motion without having to generate root motion.

avatar image NextVertex · Apr 27, 2017 at 11:24 AM 0
Share

Checking "loop" is exactly what i needed. Thank you very much !

avatar image
0

Answer by jinincarnate · Aug 11, 2016 at 06:27 AM

When developing games root motions for the avatar is never used , animations are only for moving the different skeleton parts in its place but the actual displacement in space is done using scripts.

What will happen if root motion was used - when the animation will end and start again the avatar will go back to the same position where it started from.

So to move your avatar you can use different functions like transform.Translate , transform.Lerp,transform.Forward(check unity documentation for more details on these functions)

@Okplayback

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
0

Answer by augivision · Apr 02, 2018 at 02:19 AM

Can any of you give an example of a C# script for:

  1. Create a waypoint array from empty game objects.

  2. Move object or player from current position to first waypoint at a certain speed.

  3. Rotate towards or Look towards first waypoint and play "Walk" animation.

  4. When the first waypoint is reached, play a "Laugh" animation, then walk towards the second waypoint at the end of the "Laugh" animation.

  5. At the second waypoint, stop and play the "Cry" animation. Then proceed to waypoint 3.

  6. Continue to add as many waypoints as you like in the array and attach an animation at each waypoint. The character will stop at the new waypoint, play the animation, then rotatetowards newer waypoint and start walking or running at a certain speed.

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

124 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

Related Questions

Problems with using the same Animator Controller on multiple objects. 0 Answers

How to make character animate as he's rotating? 2 Answers

Blend Trees with NavMeshAgent 0 Answers

Is there a possibility to reuse substate machines in other animator? 0 Answers

How do I add animations as "children" or "built-in" objects under an animation controller? 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