- Home /
How to refresh rigidbody colliders modified at runtime
I have a GameObject with a Rigidbody attached. It has multiple children with mesh colliders. If I change those mesh colliders at runtime, collision detection stops working.
My solution is to disable the GameObject, change the child colliders, then re-enable it. This works, however, it doesn't seem like the best solution. I've tried calling Sleep before the changes and WakeUp after. This does not work (and according to the docs, it doesn't seem like it should but I tried it anyway because I've seen people suggest it for similar problems). Also calling ResetCenterOfMass doesn't force a refresh either.
Is there a cleaner way of doing this than setting the game object inactive/active?
Unity 2017.3
Your answer
Follow this Question
Related Questions
Disabling isKinematic on a hinge joint at runtime - keeping motion to axis 0 Answers
Rigidbody slowly falling through mesh collider 0 Answers
Moving Trigger not detecting stationary MeshCollider 0 Answers
Fast moving object not detect collision 3 Answers
Non-coding question. How would I achieve this effect? 1 Answer