three.js rotate Object3d around Y axis at it center
This answer helped me, but the code isn't quite correct. The axis has to be a unit vector, and object.rotateOnAxis()
is incremental.
Here is a working example:
var axis = new THREE.Vector3(4, 0, 7).normalize();
var speed = 0.01;
// set up scene, etc.
function animate () {
// other code
if (object) {
object.rotateOnAxis(axis, speed);
}
}
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