Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 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
2
Question by Spidlee · Sep 08, 2014 at 09:51 AM · animatorrigidbody2daddforceik

Animator and Rigidbody2D Conflicting. Help~

Hi guys and ladies,

So i've got a character set up using a hierarchy of sprites and a simple IK script attached to it. at the top of the hierarchy, i've got an empty gameobject which i've added animation controls and rigidbody2D to it.

The issue i'm facing is that it seems the animator is conflicting with the physics. On the animator, i've unchecked "apply root motion", changed update mode to "animate physics", but despite doing this, AddForce is giving me weird results.

Eg.

1) AddForce(new Vector2D(500, 0)) does not move the character horizontally.

2) AddForce(new Vector2D(0, 500)) "teleports" the character UP instead of pushing it gradually up.

3) the mass and gravity seems haywire too. the character is "super heavy", but drops super slow.

4) if i set the character to start from a drop, when it collide with something, it resets back to the start (drop) position.

Anyone know what i'm doing wrong? Any help would be appreciated. Thanks!!! :)

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
3

Answer by Spidlee · Sep 09, 2014 at 05:52 AM

Ok for anybody else who has this issue (and i've seen alot of people with this issue), I managed to resolve my issue with rigidbody2D & animator conflict with the below "hack".

So the way i did my animations was via the head of the hierarchy. This allowed me to manipulate all the children under one controller. Because of that, I also added the rigidbody2D and boxcollider2D onto this head. That's where the conflict happens. So to solve this, I added the whole hierarchy under another empty game object, which gives it a new head that has no animator. Add the rigidbody2D and whatever else, boxcollider2D, playercontroller script, etc to this new head. And SOLVED :)

Below is the visual solution, hope this helps someone else :D

Old Hierarchy: Player (head of char, of which animations are done via, animator is attached here. DO NOT PUT THE RIGIDBODY2D here.) -> Sprite parts (has its own hierarchy again) -> etc

New Hierarchy: PlayerController (NO ANIMATOR, attach rigidbody2D here) -> Player (Animator here) --> Sprite parts --> etc

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 DarkSlash · Mar 19, 2015 at 09:20 PM 0
Share

Perfect solution! Worked for me!

avatar image hoarfrost31 · Sep 17, 2017 at 07:54 AM 0
Share

Ths worked for me. Thank you so much for sharing this.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Jumping with Rigidbody.AddForce not working? 1 Answer

what is the foot ik button for 1 Answer

turn on/off FootIK by script 0 Answers

Shoot logic, bullet instantiation 1 Answer

Keeping 4-Legged entity grounded 0 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