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 aguskos · Jan 17, 2018 at 11:25 AM · animatorroot motionmechanim

Mixing root motion animation and in place animation

So as far as I understand you use root-motion to actually move your object with animation, correct me if I am wrong. So I want to use it for cutscenes, but later on I want to use the same object for normal gameplay with root motion beeing switched of. But my character doesn't move and animator says "Root position or rotation are controlled by curves". alt text So how would you go about this? Perhaps I am doing something completly wrong but my actual goal is being able to move character with animation when it's needed and by coding when needed.

UPD ------------

So I will update my question a bit, because I still don't understand. I am providing code for the object and coresponding animator controller. As you can see NewState is just an empty state. cs_theBeginning_brother is the actual cutscene. It's not connected to anything so as I thought it would not have any effect on the object whatsoever. If I delit it everething works fine(object is moving). The really odd thing for me is that when cs_theBeginning_brother is added to the animator controller the object doesn't move whith root motion being switch off, but it does move with activated root motion. Code is the same in all three scenarios. Sorry I know thats a lot of stuff but I am really confused so I will apreciate any help on this.

alt text

     private void Start()
     {
         rb = GetComponent<Rigidbody2D>();
 
     }
     private void FixedUpdate()
     {
         rb.velocity = new Vector2(2, 0);
 
     }
   
 


forask.png (17.6 kB)
lol.png (33.2 kB)
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

Answer by meat5000 · Jan 17, 2018 at 02:00 PM

Root Motion is best achieved by actually manually moving the model per keyframe in your external 3D modeller. You can then switch root-motion off and perform the animations in-place. Curves can be created or adjusted from within Unity's own animation window.

Comment
Add comment · Show 2 · 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 aguskos · Jan 17, 2018 at 05:40 PM 0
Share

Thank you for clarification with root motion. But I still don't understand how to move my object, with root motion being switched off I get this message "Root position or rotation are controlled by curves" as you can see on screenshot. So I can't move it, how to solve this?

avatar image meat5000 ♦ aguskos · Jan 17, 2018 at 07:27 PM 0
Share

That's not an error, its a statement :) Its telling you its under the control of the curves. Perhaps set up some curves?

Root motion is entirely optional. Here is the old tut on Root-$$anonymous$$oving an In-place animation

https://docs.unity3d.com/$$anonymous$$anual/ScriptingRoot$$anonymous$$otion.html

If your model HAS Root-$$anonymous$$otion but you want it to be in place, click on the Prefab/Imported file for your object. In the Inspector's Import -> Animation section you can see three Boxes that will prevent the movement of animations in certain ways.

avatar image
0

Answer by Dray · Jan 17, 2018 at 08:04 PM

Forget about the curves for a moment, what you need is a custom script that moves your player when needed. Something like this:

 void Update() {
     if (rootMotionIsDisabledAndImMovingForward) {
         transform.position += transform.forward * speed * Time.deltaTime;
     }
 }

or if you are using physics:

 void FixedUpdate() {
     if (rootMotionIsDisabledAndImMovingForward) {
         rigidbody.MovePosition(transform.position + transform.forward * Time.fixedDeltaTime);
     }
 }

you could also use the rigidbodys velocity or even control the velocity using one of these magical AnimatorCurves you mentioned but maybe a simple approach as above suits your needs allready

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

84 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

Related Questions

Trouble using root motion. 0 Answers

Issues with Root Motion changing character position between animations 0 Answers

Root Motion On Slow Animations 0 Answers

Using root motion scripting for specific animations 1 Answer

Handling Build-up of Root Motion Errors Over Time 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