Orbit Control changes angle when target is changing position

I have an issue creating a third-person orbit camera.
When my character is moving forward and backward angle and distance from camera to orbitControll target changes, how to make it fixed, fixed distance, and fixed angle, like in popular mmorpgs,

in the animation loop, I have:

  orbitControls.target.copy(player.position);
  orbitControls.update();

Instead of copying the target - add player movement delta to both target and camera positions. That way both will be moved evenly and the angle between target and the camera will remain unchanged.

2 Likes
camera.position.add( player.position );
camera.lookAt( player.position );
orbitControls.update();

Hope this helps!
Source: Third person camera - #2 by PavelBoytchev

solved like this

  camera.position.sub(orbitControls.target);
  orbitControls.target.copy(player.position);
  camera.position.add(player.position);

  orbitControls.update();
1 Like