Skip to main content
1 of 4
OC_RaizW
  • 1.5k
  • 8
  • 27
  • 49

How to create a boxcollider, which surrounds the gameobject and all of his children?

I have a Car, who needs a Box Collider. If the car would be 1 single mesh, i would only need to call:

        boxCol = gameObject.AddComponent<BoxCollider>();

and it would create a boxCollider, which fits perfectly my car, based on my car's mesh.

Now I have a car which exists of many different parts in the hierarchy. (for example: every door is 1 seperate game object)

now i need a script which changes the boxCollider so, that it has the box surrounding the wholecar.

i found: http://answers.unity3d.com/questions/22019/auto-sizing-primitive-collider-based-on-child-mesh.html

but it just doesnt get me the right collider

OC_RaizW
  • 1.5k
  • 8
  • 27
  • 49