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



我使用这个360度图像,我需要相机保持固定在(0,0,0)

如果我更新相机的位置,控制停止工作。

我看过这个帖子https://codeworkshop.dev/blog/2020-04-03-adding-orbit-controls-to-react-three-fiber/,它有一个修复,但似乎过时了,扩展功能不能使轨道控制可用。

我试过各种

的组合
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]);

是否有一个简单的方法来锁定相机的位置与轨道控制,只是旋转相机?

我认为您可以将controls.maxDistance设置为非常小的值,例如0.01。这样,它只会绕着原点旋转一个难以察觉的量。

您可以在文档中阅读更多关于.maxDistance属性的信息](https://threejs.org/docs/index.html?#examples/en/controls/OrbitControls.maxDistance)

最新更新