- Home /
Change Collider Bounds at Run-time
Exactly the same as holding shift and been able to move the side of within the editor, is there a way to reposition a side (i.e. collider.bounds.max.x = x) at run-time.
c.bounds.SetMinMax(c.bounds.min, new Vector3(c.bounds.max.x, c.bounds.max.y, 5f));
I've tried to set the bounds, however they are read-only and since this is a value type I guess I'm just getting a copy of the bounds back.
So anyway to resize say max.x of a collider at run-time?
P.S. Using collider.extents or collider.size would work, but I'd need to recenter the object to align it back to it's original alignment.
I've put up a really bad illustration of what I'm trying to do (you'll notice I didn't have a text tool for the image) :D

Your answer
Follow this Question
Related Questions
Positioning gameobject on collider bounds. 1 Answer
bound.Intersects returning true when false 1 Answer
Matching an object's size 1 Answer
Internal collisions 1 Answer
How to check if a point is in a rotated BoxCollider? 2 Answers