This question was
closed Apr 21 at 08:46 AM by
TheMaskedKasper for the following reason:
The question is answered, right answer was accepted
Question by
TheMaskedKasper · Apr 15 at 12:07 PM ·
collisioncolliderschildrenresize
How can i resize through script the size of box collider
I'm adding prefabs from the resource folder and i check if the mesh contains childen and give every child a box collider. The problem is that all the box collider are of scale 1 1 1 that means if i have a skeleton body it causes a lot of problems . This is how i assign the box colliders :
foreach (Transform g in obj.GetComponentsInChildren<Transform>())
{
BoxCollider MeshCol = g.gameObject.AddComponent<BoxCollider>();
}
how can i adjust each box inside to match the dimension of the children of the meshes.?
I have tried using mesh collider and skinnedmeshcollider instead but even after turning convex on it didn't work .
Comment
Follow this Question
Related Questions
Tilemap Collision 2D colliding with ground. 0 Answers
OverlapSphereNonAlloc Not Working? 1 Answer
Colliders for tunnels 0 Answers