help needed to changing the boxcollider size at runtime:
for example i have 2 game object each which attached with box collider
box a
and box b
i want to change the box collider size of box a :Boxcollider size from nomal size to my extended size from other size that i give in scirpt. script that is attached with box b
how to call that (box a) collider size in b script/to change the size !
note:
this will happen after the box a collision with box b!
Your problem sounds like you want to change the size of the OTHER collider, not the collider of the GO with the script attached. In OnCollisionEnter for box b, you have Collision.collider, which contains box a’s collider. Do the size set on it.
void OnCollisionEnter(Collision collision) {
BoxCollider a = collision.collider as BoxCollider;
a.size = new Vector3(20f, 5f, 20f);
}