#Need help with moving Camera position

16 messages · Page 1 of 1 (latest)

thick quail
#

Here is my issue.
Camera Position is [100,500,100] and it was looking at [100,0,100].
I used below code to move camera position. [200, 50, 100] (this case new Y is smaller than before)
But it is looking at other position and my rendering mechanism broken.
screenshot attached and also i found that case the panSpeed is too high. (only when new camera position is smaller than before)
Also attched code.
You can see I tried with lookAt function also.
This case it worked but panSpeed issue still exist.
Curious thing is then I not use the fourth image content, the lookAt not worked and 1 frame after it lookAt back position.
Please help me

minor steeple
#

If you are using orbitcontrols... after you move the camera you will need to move the controls.target point to where you want the camera to look at.

so if you're panning , you want to add the same amount to both camera.position and controls.target

thick quail
minor steeple
#

are you using orbitcontrols?

#

oo its an r3f thing?

thick quail
minor steeple
#

ya.. so controls is your orbitcontrols

#

let controls = new THREE.OrbitControls()

controls.target is a Vector3

thick quail
minor steeple
#

yeah thats some r3f stuff.

#

prolly want to ask one of those folks

#

in help-r3f channel.. or their discord ^

thick quail
#

what is the solution?

#

could you give me code snippet?