What is the "center" of a Three.js object?

Kolban picture Kolban · Jun 25, 2016 · Viewed 10.7k times · Source

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?

Answer

WestLangley picture WestLangley · Jun 25, 2016

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