When to use camera.up or camera.up.set and why?

When analysing examples sometimes they use

camera.up = new THREE.Vector3(0,0,1);
camera.lookAt(new THREE.Vector3(0,0,0));

… sometimes they use:

camera.up.set(0, 0, 1);
camera.lookAt(0, 0, 0);

… sometimes they use:

camera.position.z = 100;
camera.lookAt(scene.position);

… or sometimes they do not use something like this at all

Con someone give me a hint for a better understanding, or, where I could read a clear explanation of this?

1 Like

Altering the up vector is done in only a few examples and normally not necessary. This happens to accommodate the fact that certain models are defined in coordinates system where the Z axis represents the vertical (up) axis.

The lookAt() method calls are necessary so the camera looks at the coordinates systems origin or at the position of the scene (which is more or less the root object of the scene graph). In most cases, the position value of scene is (0,0,0) (the origin).

1 Like

Many thanks for magic word “vertical”, @Mugen87.

1 Like