• 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
Question by vbbartlett · Dec 06, 2012 at 05:20 PM · physicsrigidbodyworldremove

Can you remove a rigidbody from a gameobject AND the "world"

Is it possible to remove a rigidbody from a gameobject AND the physics simulation? Background: creating collectible items that are dropped. These items drop, come to rest and then the rigidbody/collider should be removed from the gameobject AND from the physics simulation.
(Actually I don't care if they are removed from the gameobject just that the physics simulation stops processing them)

I want the gameobject to remain, think of it as debris if that helps. Changing layers or such concerns me because they are still being simulated and I want A LOT of these to be generated over time. (Thousands to maybe millions) without bringing the physics simulation to its knees. (Yes I know I will at some point become display bound, but I want that to be my bottle neck, not physics, that is removed, no collision)

Comment

People who like this

0 Show 0
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

3 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by fafase · Dec 06, 2012 at 05:48 PM

 collider.enabled = false;
 rigidbody.isKinematic =true;

No physics, no collision

Comment

People who like this

0 Show 0 · 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

Answer by Screenhog · Dec 06, 2012 at 05:25 PM

Why not just deactivate the rigidbody component once it falls asleep? (Details on Rigidbody Sleeping)

Comment

People who like this

0 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 vbbartlett · Dec 06, 2012 at 05:37 PM 0
Share

How do you deactivate the rb component?
Sleep is currently what I am using, but I am putting them on a "NoColis" layer, but am uncertain about performance when I ramp up the numbers.

avatar image

Answer by astorga · Dec 06, 2012 at 05:31 PM

To stop physics simulation with a specific GameObject, just set "isKinematic" to "true" in Rigidbody component. You can still use OnTrigger and OnCollision functions.

Comment

People who like this

0 Show 5 · 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 vbbartlett · Dec 06, 2012 at 05:33 PM 0
Share

Please reread the question.

avatar image astorga · Dec 06, 2012 at 05:35 PM 0
Share

I considered the following sentence: "(Actually I don't care if they are removed from the gameobject just that the physics simulation stops processing them)"

avatar image vbbartlett · Dec 06, 2012 at 05:40 PM 0
Share

But the still collide with things... I need them removed

avatar image astorga · Dec 06, 2012 at 05:46 PM 0
Share

In that case, just set rigidbody.detectCollisions to false. According to manual, "Disabling collision detections is useful when you have a ragdoll which is setup to be kinematic and you want to avoid heavy collision detection calculations on that rigidbody."

http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody-detectCollisions.html

avatar image vbbartlett · Dec 06, 2012 at 05:50 PM 0
Share

That doesn't work, that simply turns off collisions, the rb is still active in the world, (falls forever)

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

12 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

Related Questions

How to do "cosmetic" physics with joints to produce secondary character motion? 1 Answer

rigidbody2D.addforce in collider 1 Answer

Why AddForce up is higher than AddForce right? 0 Answers

Engine weight Simulation 2 Answers

Object w/ constant force can't move on top of other objects 2 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