When I use Blender to model an object, I am able to explicitly define its center position from which translations and rotations occur. When working with Three.js objects, I don't seem to find an equivalent.
Does a Three.js object have a property that defines its "center" position? If not, how is the the center of the object determined?
In three.js, an object's "center" is the origin in the object's local coordinate system.
If your object is not rotating around the point you want, then you need to translate the vertices of your geometry so the desired center is at the origin.
geometry.translate( distX, distY, distZ );
See this answer for more information and an alternate solution.
three.js r.78
The center can be determined by the geometry's boundingBox, which will be computed by calling computeBoundingBox()
method;
If the local coordinate system's origin is not the center of the geometry, call center()
method will adjust the geometry to center it at the origin.
see three.js source code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With