Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by wildcard · Oct 22, 2010 at 11:11 PM · collisionrigidbodyactive

Disabling/Enabling GameObjects with Attached Rigidbody Components leads to strange behavior

Hi,

I am porting an existing, large Unity game to a mobile platform. Because there are performance issues, I am interested in disabling all but the room the player is currently in for each level. The approach basically works, but there are some issues.

Game objects with attached RigidBody components start behaving very strangely when they are enabled after first being disabled. They start moving around erratically, and don't seem to handle collisions anymore. I have been able to work around some of these issues by explicitly setting the freezeRotation and isKinematic properties for RigidBody components, but the overall behavior is still off.

I am new to Unity and apologize if this is a noobish questions, or if the solution seems obvious.

A little bit more background regarding the issue: all objects are ultimately parented to the room that they are in. When the player transfers from one room to the next, I turn off objects in the current room by calling oldRoom.SetActiveRecursively(false), and activate the new room by calling newRoom.SetActiveRecursively(true).

Disclaimer for posters that wish to point me towards occlusion culling: I know about occlusion culling as a standard way to increase performance, but it doesn't seem appropriate in my case, as I am running low on memory, and don't have room for occlusion maps.

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 The_r0nin · May 05, 2011 at 12:09 PM 0
Share

Have you set the rigidbody.velocity and .angularVelocity to Vector3.zero? I've found that disabling and enabling doesn't always clear any internal variables, so when a GO is enabled, it might carry old velocities to new places. Try enabling, then setting the two velocities to zero in your script.

avatar image clfischer · Apr 04, 2012 at 11:05 AM 0
Share

I have a similar problem. A ragdoll character in my game is SetActiveRecursively(false) at the beginning, then later on, I change its position and SetActiveRecursively(true). The various sub-components of the character seem to be split up into different places in the scene. The rigid bodies attached to the limbs appear in a pile along with the mesh somewhere above the ceiling, but the root gameobject of the character and some of the colliders appear at the correct location.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Lekta · Dec 10, 2010 at 09:19 AM

I have same troubles with rigidbodies. When I reenable them, GO starts move uncontrollably. Know anybody solution?

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 Aldwoni_legacy · May 05, 2011 at 12:00 PM 0
Share

make a seperate question

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

1 Person is following this question.

avatar image

Related Questions

Advice for Intersecting Colliders 0 Answers

Object going through (or getting inside) another object 1 Answer

[SIMPLE] Not loose speed when destroying colliding object 1 Answer

collision problem 1 Answer

Any way to ignore collision between rigidbodies and colliders/character controllers? 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