Reputation: 1472
I am dynamically adding meshes to an Object3D
and was wondering if it was possible to get the center of the object such that I can do rotations and on translations equally on the whole mesh and not 'centered' on one end. I know you can access the geometry property of Mesh
but I couldn't find an equivalent for Object3D
.
Thanks!
Upvotes: 0
Views: 2089
Reputation: 12642
You can use box3.setFromObject(Object3D) to figure out the bounding box of your object and from that the center of your object3D. Take a look at Threejs: computing the bounding box of rotated text and Three.js How to get position of a mesh?. I think they will help you.
Upvotes: 1