I have a three.js scene where I can add and edit objects. Recently, I added a checkbox for "Rotate Camera" which is working well. However, the issue I am facing is that the transformControls attached to the object seem to rotate differently: when I stop the rotation, the controls are displaced in comparison with the object. Here is my function:
function enableCameraRotation() {
"use strict";
return {
ROTATE_ON_Y_AXIS : false
};
}
var rotationSettings = enableCameraRotation();
My GUI.DAT button:
guiCamera.add(rotationSettings, 'ROTATE_ON_Y_AXIS').name('Enable Rotation');
And my animate() function:
function animate() {
requestAnimationFrame( animate );
THREE.AnimationHandler.update( 0.05 );
if (rotationSettings.ROTATE_ON_Y_AXIS) {
scene.rotation.y = (scene.rotation.y + 0.005 * 4) % (Math.PI * 2);
}
renderer.render( scene, camera );
update();
}
Can anyone help me identify where the problem lies?