I encountered problem, – when clicking on some object in scene, camera must center on this object. For this i need center coordinates of object (y axis). How i can compute this? Tried to sum all vertices of this object and divide it on vertices count, but this, of course, wrong decision.

## 3 thoughts on “Get center of object”

Comments are closed.

You can get center of geometry bounding box:

Then you could set your camera’s target to object position plus center:

is now:

(as of r47)

Conceptually, it’s adding two vectors and taking the half of the result. I’m not sure if it’s faster, but it’s more… concpetual: