Collider.bounds.extends.x returns local radius (SphereCollider) - Why?

Hey ,

today I updated my project to version 2017.2.0f3 (was working on 2017.1.1f1 before).

This…

offsetX = objectCollider.bounds.extents.x;

…used to return the bounds in world space of my SphereCollider, but now it only returns the radius of the component. The documentation says it should return the bounds in world space. Am I missing something, is this a bug or was this changed since the last patch? I’m a bit lost on this one.

Maybe someone out there knows whats going on. :slight_smile:

Cheers

Hi,

I just took a quick glance at the documentation and source code surrounding the bounds and just from that, I can’t see that any version intentionally returned the size of the bounds as its extents value. So while I’m not 100% sure, that this is not new behavior, it is definitely intended. See: Bounds.extents where it says

I guess you might have been thinking of Bounds.size?

I tried .extends and .size. The problem is not that the variable returns half or twice of what I need. I need the current radius in world space of this collider, since I’m rescaling the parent of it. The radius of my SphereCollider is always the same while the whole GameObject is rescaled. Every method that used to return the right value before the patch now just returns the radius that can be set in the inspecor for example.

This is a bit old, but I had the same issue and solved it by multiplying the result by transform.lossyScale.x (global scale of the object)