使用 OrbitControl 进行缩放后,THREE.js 正交相机位置未更新 [英] THREE.js Orthographic camera position not updating after zoom with OrbitControl

查看:40
本文介绍了使用 OrbitControl 进行缩放后,THREE.js 正交相机位置未更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 THREE.OrbitControls 来缩放 THREE.OrthographicCamera.但是,即使认为正交相机在缩放时可以正确渲染,相机上更新的只是缩放"属性.即使在调用 camera.updateProjectionMatrix() 之后.我是否需要根据更新的缩放"属性手动更新相机的位置"属性?我想在我的 UI 中显示它的位置.

I'm using THREE.OrbitControls to zoom a THREE.OrthographicCamera. But, even thought the ortho camera renders correctly as zoomed, all that is updating on the camera is the 'zoom' property. Even after calling camera.updateProjectionMatrix(). Do I need to manually update the 'position' property of the camera based on the updated 'zoom' property? I want to display its position in my UI.

推荐答案

缩放"不应改变相机的位置.缩放会改变相机的视野,同时它保持在相同的位置.放大与裁剪图像相同.

"Zooming" should never change a camera's position. Zooming changes the field of view of a camera, while it remains in the same position. Zooming in is the same as cropping an image.

当您靠近或远离对象时,这称为小车".当你有正交相机时,因为没有透视变形,推拉效果很小.

When you move closer or further away from a subject, this is called "dolly". When you have an orthographic camera, because there is no perspective deformation, dollying has very little effect.

我是否需要根据更新的缩放"属性手动更新相机的位置"属性?

Do I need to manually update the 'position' property of the camera based on the updated 'zoom' property?

是的,但是基于..."是非常非常相关的,对于每个缩放级别,您的相机都有无数个可行的位置.

Yes, but "based on the..." is very very relative, for each zoom level you have infinitely many viable positions for your camera.

这篇关于使用 OrbitControl 进行缩放后,THREE.js 正交相机位置未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆