• 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
7
Question by ina · Dec 26, 2010 at 10:13 AM · physicsrigidbodyruntimedisableenable

Enable or Disable Rigid Body at Runtime?

Is it possible to enable/disable the rigid body component at runtime?

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

9 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by kablammyman · Jun 18, 2012 at 11:36 PM

you CAN disable a rigidbody by doing this:

rigidbody.active = 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 vexe · Aug 22, 2013 at 05:08 PM 1
Share

That is NOT true. Doing this will disable the gameObject that you're script attached to, not the rigidbody. If you look at the rigidbody component you won't see a checkbox for enabling/disabling it.

avatar image
19

Answer by dcocchia · Apr 14, 2012 at 10:35 PM

You probably just want to do .rigidbody.isKinematic = true.

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 123iamking · Feb 03, 2016 at 03:32 AM 0
Share

Yes, that's the trick!

avatar image jeagudelo76 · Jan 20, 2021 at 09:03 PM 0
Share

Finally !!! Thank you so much <3333333333

avatar image
1

Answer by bawi · Aug 26, 2011 at 08:29 AM

can we add "Add Component" on the selected game object we want? how?

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 srmojuze · Jul 29, 2014 at 06:51 AM 1
Share

thegameobject.AddComponent("Rigidbody");

avatar image ahmedkhemiri466 · Aug 03, 2021 at 11:46 AM 0
Share

target_gameobject.AddComponent( Rigidbody );

avatar image
6

Answer by Eric5h5 · Dec 26, 2010 at 08:21 PM

You can't enable or disable rigidbody, but you can destroy it with Destroy and add it back with AddComponent.

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 RElam · Feb 20, 2013 at 05:29 AM 1
Share

Unfortunately, you can't if you have something depending on it, like a CharacterJoint, so you're screwed on ragdolls. Doing rigidbody.is$$anonymous$$inematic = true will give the desired behavior, but at a significant performance penalty, even with paired collider disabled.

avatar image Tryptex · Oct 08, 2017 at 05:05 PM 0
Share

@ Eric5h5 thanks sooo much, I did not know you could destroy and add a rigidbody to a gameobject, now I only have one problem, is there a way to change settings for the rigidbody when you add it the gameobject? I need to freeze the rotation on the z axis.

  • ‹
  • 1
  • 2

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

21 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

Related Questions

Disable Rigidbody Function Start 1 Answer

Connect two rigidbody gameobjects together at runtime? 0 Answers

Rigidbody velocity limiter 0 Answers

Enable/Disable a Static object 1 Answer

Disabling isKinematic on a hinge joint at runtime - keeping motion to axis 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