I have an Object3d
in Three.JS
that is a group of some Mesh objects.
I want to rotate this group around the Y axis, at it center, that is far from world center (0,0,0).
I just know the Group.rotate.y += deg
code, but for each axis direction it always rotate the object around (0,0,0), not my group center!
How can i fix this?
Read the comments
To rotate objects, activate Rotate mode by pressing RKEY. As in Grab mode, you can change the rotation by moving the mouse, confirm with LMB, or ENTER cancel with RMB or ESC. Rotation in 3D space occurs around an axis, and there are various ways to define this axis.
Have a look at Object3D's rotateOnAxis(axis, angle)
function.
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);
HTH
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