Determining the precise center point of an object

Hey guys,

I’m having a problem finding the center point of a parent object. Usually this would be transform.position, but when setting that I wasn’t sure how to originally find the exact center, and so I left it until I had proper functionality.

26184-ex.png

This is my object, it’s a parent object filled with children, these being the individual cubes. The circle denotes the current axis on which the object rotates. Meaning when it rotates every frame in the FixedUpdate it looks as if it’s rotating around something. The line denotes where I want the axis to be, dead center, so when it rotates it looks like its on a spindle.

Does anyone have an idea of how I would be able to find this?

Thanks in advance.

The geometric center of the axis aligned bounding box containing the object is at

gameObject.renderer.bounds.center

Its center of mass, which may or may not be its geometric center, is at

gameObject.rigidbody.centerOfMass

Thanks for answering.