# Box Collider center relative to GameObject

I'm trying to get the distance from the BoxCollider center of a gameobject to the bottom of that same BoxCollider. Note that the center of the collider is slighty modified.

So far, I have:

float halfHeightCollider = (bounds.size.y / 2);


I tried the following to take care of the slight modification:

float halfHeightCollider = bounds.center.y + (bounds.size.y / 2);


But seems like bounds.center give me the position of the center of the BoxCollider in the world, not relative to the gameobject, like in the inspector:

That value is the one I want. How can I get it?

You can get the center in y-axis from gameObject.GetComponent<BoxCollider>().center.y.
You will get the total size in y-axis of the collider from gameObject.GetComponent<BoxCollider>().size.y.