How to get center of an object

Hi,

I want to use an cube(lets call “A”) to move other objects(cube or capsule). Other objects will be moved when the object “A” is forwarding closely to these objects. Thus, i want to get the distance between “A” and other objects. So, i want to know the center coordination of an object? Thanks.

If your models aren’t centered. transform.renderer.bounds.center

transform.position. The only way that wouldn’t be the center is if you use off-center models that were not modeled around the origin.