Search code examples
camerathree.js

Camera rotation at three js not working proper?


I am using this function and it is not working properly. Coding is using three.js

function rotate(){
    camera.rotation.x+=0.1;
}

. If I add this at the render function it works just once and not correct meaning that the rotate function event on mouse movement I have, rotates wrong or maybe at an other centre. What I need is to rotate the camera on the x,y,z axes when the button is clicked. Any ideas?


Solution

  • You defined controls. They decide the camera rotation instead of the line you added. You have to set controls.enabled=false when you want the camera to rotate.