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
2
Question by whisker-ship · May 17, 2016 at 05:32 PM · animationcollisionphysicsrigidbodyforce

How to add physics to an animation?

Hi I have an animation thats transform position is animated to move from Vector3(-1,0,0) to Vector3(1,0,0).

I'm trying to figure how to get physics to work with this animation, for example, if while the object is moving from Vector3(-1,0,0) to Vector3(1,0,0) hits another object, I want the hit object to react as if it had been hit with force.

I've tried using 'Animate Physics' on the animator and using a Rigidbody on the object that's being animated, and I've had no luck.

Comment
Add comment · Show 2
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 Julien-Lynge · May 19, 2016 at 05:10 AM 0
Share

I believe you and I have run across the same issue:

http://answers.unity3d.com/questions/1188956/animator-animate-physics-does-nothing.html

avatar image whisker-ship · May 19, 2016 at 08:55 AM 0
Share

In found out why the physics weren't working, check the accepted answer, maybe it'll solve your problem.

3 Replies

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

Answer by whisker-ship · May 19, 2016 at 08:52 AM

I found out why the physics weren't working for me, the object that was being hit had a script that set the rigidbody's velocity to:

new Vector3(Input.GetAxis("Horizontal", 0, Input.GetAxis("Vertical")).

So the velocity would always be that even if hit by an object, resulting in its receiving collision physics not working. @Julien.Lynge

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 Amanna · May 19, 2016 at 06:14 AM

You can disable the animator component when collides with objects, and then the rigidbody will work for you to apply physics to it .

to disable Animator :

Animator anim = gameObject.GetComponent("Animator");
anim.enabled=false;

Comment
Add comment · Show 1 · 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 Julien-Lynge · May 19, 2016 at 07:47 AM 0
Share

Sorry Amanna, but the poster clearly asked about how to "get physics to work with this animation". Your answer - to turn of animations - doesn't actually address the issue.

avatar image
0

Answer by HarshadK · May 19, 2016 at 06:05 AM

There are few things you need to check for:

  • The object being hit also has Rigidbody and is not static.

  • Uncheck 'Apply Root Motion' from the Animator component on the object that's being animated.

  • Update Mode is 'Animate Physics'.

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 Julien-Lynge · May 19, 2016 at 07:45 AM 0
Share

I can't speak for @whisker.ship, but those were among the first things I tried, and they make no difference.

Have you actually tried setting this up in a scene?

avatar image HarshadK Julien-Lynge · May 19, 2016 at 10:45 AM 0
Share

Yes. I can share the scene if you want.

avatar image Julien-Lynge HarshadK · May 19, 2016 at 04:59 PM 0
Share

Yeah, that would be awesome! Since It sounds like @whisker.ship has solved his issue, do you $$anonymous$$d posting it here: http://answers.unity3d.com/questions/1188956/animator-animate-physics-does-nothing.html ?

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

103 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

Related Questions

Manually Apply Cars Collision Response Force 0 Answers

rigidbody jumping and moving with constant speed without acceleration (with video ) 2 Answers

Limit How Far an Object is Pushed After a Collision 0 Answers

How to get Satisfying Collision Physics 1 Answer

Character Controller meets Rigidbody 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