Three.js rotate Object3d around the Y axis in the center

I have Object3d in Three.JS , which is a group of some Mesh objects.
I want to rotate this group around the Y axis, in the center of it, which is far from the world center (0,0,0).
I just know the code of Group.rotate.y += deg , but for each axis direction it always rotates an object around (0,0,0), not my group center!
How can i fix this?

UPDATE:

Read comments

+6
source share
1 answer

Take a look at the Object3D function rotateOnAxis rotateOnAxis(axis, angle) . It should be something like:

 //declared once at the top of your code var axis = new THREE.Vector3(0.5,0.5,0);//tilted a bit on x and y - feel free to plug your different axis here //in your update/draw function rad += radIncrement; object.rotateOnAxis(axis,rad); 

NTN

+6
source

Source: https://habr.com/ru/post/950461/


All Articles