Reputation: 157
So I want to move my cameras position around in three.js, but as I move it, I want the cameras rotation to automatically update to point at the origin.
So if i have the camera set as:
camera.position.set(25,25,25)
I would like the camera.rotation to be updated so that it is facing the world origin.
Upvotes: 0
Views: 690
Reputation: 900
You can set the camera to look at or target a specific position in your scene but using the lookAt()
method - https://threejs.org/docs/#api/en/core/Object3D.lookAt
In this case, setting camera.lookAt(0,0,0)
will point to the centre of the 'world'.
Upvotes: 1