带固定相机位置的R3F轨道控制

发布于 2025-01-24 14:11:33 字数 762 浏览 3 评论 0原文

需要摄像机固定为(0,0,0)

我正在将其用于360映像,如果我更新了控件停止工作的相机位置,则

。我已经看过这篇文章 https ://codeworkshop.dev/blog/2020-04-03-Adding-orbit-controls-to-react-three-fiber/ 哪种有修复程序,但似乎过时了,扩展功能' t可以提供轨道控制。

我尝试了各种组合

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

,还是

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

有一种简单的方法可以用轨道控制锁定相机位置并旋转相机?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌吟 2025-01-31 14:11:33

我认为您可能可以将controls.maxDistance设置为非常小的东西,例如0.01。这样一来,它只会通过不可察觉的数量旋转其来源。

您可以在文档中阅读有关.maxDistance属性的更多信息] “ rel =“ nofollow noreferrer”> https://threejs.org/docs/index.html?#examples/en/controls/orbitcontrols.maxdistance )

I think you might be able to set controls.maxDistance to something really small, like 0.01. That way it only rotates around its origin by an imperceptible amount.

You can read more about the .maxDistance attribute in the docs](https://threejs.org/docs/index.html?#examples/en/controls/OrbitControls.maxDistance)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文