c# - 如何获得 google-cardboard 相机 FOV?

标签 c# unity-game-engine google-cardboard google-vr

我正在使用 Unity3d 和 Google Cardboard sdk 开发一个应用程序。我一直在尝试获取各个纸板相机的视野属性。这在编辑器中工作正常,但是,当我将其构建到 Android 时,相机的 fieldOfView 属性似乎返回错误的值。

Camera cam = GameObject.FindWithTag("Camera_Left").GetComponent<Camera>();
float fov = cam.fieldOfView;

这是访问此内容的正确方法吗?

非常感谢任何建议!

编辑

澄清一下,我不需要更改 FOV。我只需要获得相当准确的垂直 FOV 值。我正在尝试使用 FOV 计算游戏对象在相机中显示的大小。

最佳答案

使用 VR 时,有许多值决定 fieldOfView。它只是不再是那个 Camera.fieldOfView 属性了。应该使用 StereoController 类来获取此信息。

StereoController stereoCtrl = GvrViewer.Controller;
Debug.Log("Fov: "+stereoCtrl.matchMonoFOV);

还有其他变量需要查看,例如 stereoCtrl.stereoMultiplierstereoCtrl.matchByZoom

关于c# - 如何获得 google-cardboard 相机 FOV?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40469183/

相关文章:

c# - 解决继承问题

c# - InDesign COM 引用位于 obj 中但不在 bin 目录中

c# - 如何将东西添加到 C# 中的现有基类中?

c# - iOS 上的 Unity Google Cardboard 显示问题

javascript - 使用设备的方向围绕原点运行

c# - 在 Mono 2.10 中使用表值参数 (SqlDbType.Structured)

azure - Windows Azure 和 Unity3d

unity-game-engine - Mathf.Lerp 错过最终值

unity-game-engine - Unity3D : NullReferenceException: Object reference not set to an instance of an object

c# - 移动纸板