• 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
1
Question by LessThanEpic · Aug 20, 2014 at 04:28 AM · physicsrigidbodyiskinematic

Rigidbody not responding after toggling isKinematic

I've noticed this issue on the iPad Mini and in the Unity Editor in the last couple of days.

I have a GameObject that I need to be under the control of scripts for some parts of the game and under the control of physics for other parts of the game. Sometimes after I've had isKinematic on the rigidbody set to true and I toggle it back to false the rigidbody does not respond right away. If I toggle the isKinematic on and off in the inspector or if I have another rigidbody collide with it then it starts working again.

For now I'm using a workaround of adding a very small force to the rigidbody in the script after I set isKinematic back to false as a way to "kickstart" the physics. I'm wondering if anybody else has seen this issue or knows what the cause is.

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
3
Best Answer

Answer by HarshadK · Aug 20, 2014 at 11:24 AM

When you set the rigidbody to isKinematic then the rigidbody sleeps and when you set isKinematic to be false you also need to wake up your rigidbody in order for it to respond to the physics properly.

Use Rigidbody.WakeUp after you set your rigidbody's isKinematic to false. Something like:

 rigidbody.isKinematic = false;
 rigidbody.WakeUp();
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 LessThanEpic · Aug 20, 2014 at 04:41 PM 0
Share

Perfect, thanks!

avatar image NND · Jan 03, 2015 at 03:09 PM 0
Share

Very good answer !!!

avatar image
0

Answer by Dave xP · Aug 20, 2014 at 11:14 AM

If isKinematic is enabled, Forces, collisions or joints will not affect the rigidbody anymore. Didnt you read the docs?

It simply means that velocity and torque and all that stuff will be reseted to no force, no movement, nothing... and thats why you have to readd forces to move it when you set isKinematic to false again.

One thing you could do, is storing the current velocity and torque in a variable before setting isKinematic to true and readd them after you changed isKinematic back to 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 LessThanEpic · Aug 20, 2014 at 04:46 PM 0
Share

I have read the docs. Be nice. ;)

Your solution would work well if I was trying to pause the rigidbody and then have it pick up where it left off when I'm done. But my problem is that after I set is$$anonymous$$inematic back to false the rigidbody ignores all physics, including gravity, which I shouldn't have to add back.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

how to create Magnetic repulsion ? 0 Answers

Hooking RigidBody.AddForce 0 Answers

Is there a way to set isKinematic off only when there is a collision and that collision affect the rigidbody? 0 Answers

Same reaction with different number of objects colliding 2 Answers

Problem with Colliders 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