带固定相机位置的R3F轨道控制
需要摄像机固定为(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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您可能可以将
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)