Vertical camera rotation

I can rotate the camera horizontally with this:

camera.rotateY(amount);

How do I do the same thing but vertically?

You can use https://threejs.org/docs/index.html#api/en/core/Object3D.rotateOnWorldAxis :

  • Horizontal: camera.rotateOnWorldAxis(new Three.Vector(0.0, 1.0, 0.0), angle)
  • Vertical: camera.rotateOnWorldAxis(new Three.Vector(1.0, 0.0, 0.0), angle)

This will properly rotate camera even if it’s tilted at some awkward angle.
If you need to rotate camera horizontally / vertically along it’s local axes, it’s probably enough to use rotateY / rotateX.

1 Like