Camera.position.set - what are the parameters?

Hi all,

This might seem like a very stupid question but I thought I understood camera.position.set for a perspective camera but after playing around with it more today I am not so sure. I am struggling to understand what each of the parameters are doing and how they impact on each other. Has someone a simple explanation?


As .position is THREE.Vector3(), then have a look at the docs on it:

sorry I know it’s a vector of three number. What I would like is for clarification is what these numbers do for camera.position.set()

.set() is a method. Its name says about what it does, it sets three floats in its parameters to three components of a vector.
Or do you want to know something else? And I just can’t get what it is. Could you provide a live code example that shows the situation that you don’t understand?

These number set the camera position in the 3d space (x,y,z) coord

1 Like

I’ll try and better explain where I am coming from

If you look at the first runnable example on this page camera lesson and go line 14

camera.position.set(0, 10, 20);

As I adjust the first, second and third variable they don’t seem to be doing what I would expect them to do but maybe the scene is playing tricks with my eyes. So for example if I change the first variable from 0 to 10 is that just moving the camera 10 units to the right while still looking at the same point. Is the second variable just setting the y height of the camera while still looking at the same point. And is the third just moving further way as it increases? Is it as simple as this?

Are all these positions relative to what you set the camera to lookAt()


Yes the lookAt method is use to set the camera looking position
So if you set the camera position to camera.position.set(10,10,10) , so now the camera is at 10 units from each axis.

camera.lookAt(new THREE.Vector3(1,1,1))

It means whatever the camera position it always look at point (1,1,1)

1 Like

I have it now!! Many thanks

1 Like