0
votes

I just want to know how I can rotate this camera ( aerialCamera ) to 180°? I try camera.rotation.y but I think I'm not doing it right.

aerialCamera = new THREE.PerspectiveCamera(80, w/h, 0.1, 1000); 
aerialCamera.position.set(0, 35, 0);
aerialCamera.lookAt( scene.position );
scene.add( aerialCamera );

A picture to understand what I would like: My wish

1

1 Answers

0
votes

The issue is lookAt requires an up vector that points in the direction the top of the camera is facing. The default is up is 0, 1, 0 or up but since you're making the camera look straight down the top of the camera (like imagine you actually had a real camera in your hands with a top, front, bottom, back, etc) is not pointing up (toward the sky)

you can fix this in 2 ways

(1) give three.js an up value for the camera

either camera.up.set(0, 0, 1) or camera.up.set(0, 0, -1). Then call camera.lookAt(...)

(2) don't use look at.

so then camera.rotation.set(Math.PI / -2, 0, 0) or camera.rotation.set(Math.PI / -2, 0, Math.PI)