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 TheSky · Dec 02, 2017 at 10:30 PM · physics2droot motion

root Motion and physics2D

Hello, I have a little problem with the animation of a character. More specifically, it affects root-motion.

It's a 2D character. So far I have realized the character's movements via Unity's physics system (eg rigidbody2d.velocity).

Now, though, I have a movement that does not work that well (climbing one edge), so I thought I was using root-motion.

The problem now is that physical forces no longer seem to work properly on the figure.

I use, e.g. rigidbody2d.velocity to run the character to the left or right, nothing happens.

The figure stays in place, regardless of whether the root animation is active at the moment. (Forces up and down still seem to work).

Once I delete the said animation from the animator, everything works as usual.

"Generate root motion curves" was activated for the animation. "Apply root motion" has also been activated.

Can it be that it's just not possible to use root-motion and the physics system on the same character, or am I missing something?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by TheSky · Dec 06, 2017 at 05:21 PM

If anyone has the same problem, I have a possible solution. The problem only occurs in the 2017.X versions of Unity. In version 5.6.4 for example, everything works normally.

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 TheSky · Dec 12, 2017 at 02:14 AM 0
Share

As for the error, I now know about where the problem is and how to handle it.

The problem is actually different than I first thought. The problem is not that the Physik2D system does not work when root-motion is enabled. The Physik2D system works well.

The problem is that for some reason, rigidbody2D.velocity is overridden when root-motion is enabled.

Since the problem probably originates from the animator component, the problem can be easily avoided.

I have created an additional script.

For this script, under edit --> "Project Setting" -> "Script Execution Order" must be set to be evaluated after the default time.(that way the script will not run until all other scripts have done their thing).

I now store rigidbody.velocity in the update method and assign the stored value to the rigidbody.velocity component in the late-update method (which is evaluated after the animator component).

I do not know why rigidbody2D.velocity will be overwritten, but at least for me the problem is solved.

avatar image arguskos TheSky · Jan 25, 2018 at 07:09 PM 0
Share

So I am also struggling wiht animations, physics and root motion. I think I know how to solve it. I made a small video, where you can see different scenarios. https://youtu.be/8grSV-5E7Gc
So topone woks as you would excpect because it doesn't have animation contoller at all. But the last one works exactly the same with rigidbody and push force from FixedUpdate(). The trick is to add Position property to you active animation. It doesn't matter if you use it or not in this animation state, but if there are no position property in the active animation you will ancounter your problem as I think. Hope that helps.

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

73 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

Related Questions

Rootmotion only works on x-axis with dynamic Rigidbody2D 0 Answers

Rotate a weapon in a circle around player 1 Answer

How to correctly throw object from enemy to main character in Unity2D 1 Answer

Set the Break Point of a SpringJoint2D 1 Answer

How to get force from a rigidbody2D? 3 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