- Home /
Compound colliders are acting strangely
So I'm trying to make a system for destructible objects and for this to for I need to "shatter" the object at "glue" it together again and I'm currently testing different ways of gluing. I tried making a wall out of cubes where each cube would have a box collider and they would be parented to an object that would have a rigid body, essentially forming a compound collider. I tried interacting with it and I noticed that it behaved strangely. When I tipped it over it fell unnaturally slowly. I then tried making a similar wall with a single box, single collider and rigid body with the same configuration and it behaved totally different.
Does anyone have a solution for this where I can keep using the compound collider and still correct physics behavior?
Are you building it through code? That sometimes breaks physics, often making it look feathery. You just have to add a line to "kick" it.
Yes I am. How do I kick it? Do I add a bit force? If so how much?
So I did an experiment where I set up a three cubes with a box collider each under a single transform with a rigidbody (compound collider) and a single cube scaled to have the same shape with a single collider and a rigidbody (normal box collider), and the same problem appears to be present in this experiment. So it is not caused by scripting.
Couldn't duplicate that. 4 Unity cubes w/box collider. Child to empty with rigidbody. Tried two ways, adding the RB to the parent before/after childing the cubes. Either way it seemed to fall/bounce just fine.
The difference is subtle. It appears to me that the compound collider seems lighter and is more likely to slide, but I'm not entirely sure. $$anonymous$$y concern is that this slight difference is what is causing the problem when working with many compound colliders consisting of many primitive colliders.
Answer by Owen-Reynolds · Oct 19, 2012 at 04:38 AM
Doing anything complex to a rigidbody in code can screw up the settings. It often looks like it's moving in water.. Turning on/off isKinematic won't break it. Things like changing the scale, or reparenting can cause the glitch.
There really are other threads on this, but I couldn't find the search terms to get them (rigidbody unity broken floating didn't work.) But, you have to "kick" it afterwards by setting it Inactive then Active again (I think.) Or maybe flipping isKin off/on (the scripts where I've done it are buried in a big project.) One of those things tricks Unity into recalcing the correct values.
That sound like the exact problem I'm dealing with. I've tried flipping inactive/active, iskinematic and use gravity without success. Any other ideas on how to kick it?
Your answer
Follow this Question
Related Questions
How to get collisions on Character controller? 1 Answer
OnCollisionEnter isnt called when player lands on object 1 Answer
Rigidbodies won't collide if mass difference is too high 0 Answers
Guidelines for using rigidbody, collider, CharacterControllerScript, etc? 3 Answers
How can i Prevent Kinematic object not to pass through another rigidbody object 1 Answer