How to extend rigidbody bounds

Hi,

I am trying to increase the bounds of a rigidbody collider, but nothing seems to work. I’ve tried the following in Start() :

    for (int i=0;i<10;i++) 
    {
                GameObject go = m_gameObjects[i];
	MeshRenderer mr = go.GetComponent<MeshRenderer>();
	Mesh mesh = mr.GetComponent<MeshFilter>().mesh;
	mesh.bounds.Expand (new Vector3(1f, 1f, 1f));
	go.rigidbody.collider.bounds.SetMinMax(new Vector3(-1f,-1f,-1f), new Vector3(1f,1f,1f));
	go.rigidbody.collider.bounds.Expand(new Vector3(1f, 1f, 1f));
    }
  • but when I run the game the rigid bodies still collide as if they are still tightly wrapped to the visible mesh.
    This looks like it should be a no-brainer, so what am I doing wrong?
    Thanks.

Have you tried updating the Size property?

That’s fixed it.
Now looking at the docs, I can see Expand() and SetMinMax() are not inherited methods in BoxCollider, which would explain why using them on the parent rigidbody.collider object would not work. Anyway, that’s solved a big problem for me. Thanks!

Very helpful,I waste a lot of time on this!
collider.bounds.Expand(…)