R3F OrbitControls with fixed camera position

Viewed 365

I'm using this for a 360 image and I need the camera to stay fixed at (0,0,0)

If I update the camera position the controls stop working.

I've seen this post https://codeworkshop.dev/blog/2020-04-03-adding-orbit-controls-to-react-three-fiber/ which kind of has a fix but seems out of date, the extend functionality doesn't make orbitControls available.

I've tried various combinations of

  const onChange = () => {
    camera.position.set(0, 0, 0);
    ref.current.update();
  };

Or

  useEffect(() => {
    if (ref.current && scene.projection === SceneProjection['3603D']) {
      camera.position.set(0, 0, 0);
      ref.current.update();
    }
  }, [ref, scene]);

Is there a simple way to lock the camera position with OrbitControls and just rotate the camera?

1 Answers
Related