yomotsu / camera-controls

A camera control for three.js, similar to THREE.OrbitControls yet supports smooth transitions and more features.
https://yomotsu.github.io/camera-controls/
MIT License
1.99k stars 253 forks source link

moveTo changes target incorrectly #514

Open richfwebb opened 3 months ago

richfwebb commented 3 months ago

In some cases, moveTo moves to an incorrect position.

Using this example, https://yomotsu.github.io/camera-controls/examples/basic.html

Press the buttons:

moveTo(3, 5, 2)
lookAt(3, 0, -3)

Then repeat, and you can see the camera position keeps growing. This doesn't seem the intended behavior.

There's also a separate sequence of presses where the camera stops moving at all, if you experiment, no matter how many times you hit moveTo(3,5,2) or moveTo(-5,2,1). Maybe I misunderstand this method, and this is expected.

--

On a related note, how to correctly move the camera for third person view of a moving character that updates each frame? Maybe could add this to the docs?

I tried: moveTo, setTarget, add the camera as a child of a target object, etc. still not really sure what's right. Thanks for this great library btw!

To Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on moveTo(3, 5, 2), then click lookAt(3, 0, -3), then repeat
  3. See error

Code

No response

Live example

No response

Expected behavior

target should move to coordinates described by the button

Screenshots or Video

No response

Device

Desktop

OS

Linux

Browser

Chrome