我有一个透视相机和一个用于粒子的正交相机。我在游戏中控制透视相机的视野,我必须以相同的比例将其应用于正射尺寸。
当Fied Of View为60,Orthsize为5,当视野为120时,Orthsize为15似乎大致正确,所以我乘以1.5倍,但它失败了。
float t = Mathf.Abs (_MainCamera.fieldOfView - Vl) * 0.3f;
float orthmove = (_OrthgraphicCamera.orthographicSize * (float) Vl / (float) _MainCamera.fieldOfView * 1.5f);
_MainCamera.DOFieldOfView (Vl, t);
Debug.Log (orthmove);
_OrthgraphicCamera.DOOrthoSize (orthmove, t);发布于 2019-09-05 11:16:09
把它弄清楚。
图片来源:https://forum.unity.com/threads/how-to-calculate-horizontal-field-of-view.16114/#post-2961964
private void AdjustCamera (float aspect) {
float _1OverAspect = 1f / aspect;
_MainCamera.fieldOfView = 2f * Mathf.Atan (Mathf.Tan (60 * Mathf.Deg2Rad * 0.5f) * _1OverAspect) * Mathf.Rad2Deg;
Debug.Log (_MainCamera.fieldOfView);
_OrthgraphicCamera.orthographicSize = 5 * _1OverAspect;
}https://stackoverflow.com/questions/57797823
复制相似问题