Reputation: 127
I have a model which rotates on the X axis, but the center of the rotation is not on the axis itself. The rotation code is pretty simple:
model.current.rotation.x += 0.016; (axis and speed)
but there seems no way to define the actual axis of rotation to ensure the model just rotates around its own center. At the moment it rotates in a big circle!
Any suggestions appreciated.
:-0
Upvotes: 1
Views: 7066
Reputation: 1435
your mesh most likely is not centred, meaning the vertices point way out of the models center of mass. you can either fix this in blender, but even threejs has methods (on the geometry) that recalculate the vertices. a cheaper solution would be to render the mesh, take a box3, set it from the object, then get min/max and use it to shift the object by half of it.
Upvotes: 3