【发布时间】:2016-06-28 09:31:22
【问题描述】:
我正在尝试在 android Portrait 模式下显示全屏 Webcamtexture。 但是当我在我的设备上构建和测试它时,它的旋转和 videoRotationAngle 是 90
我使用 RawImage 作为纹理。我在一些帖子上看到您必须旋转变换并获得正确的角度。但问题是,如果我旋转 RawImage UI,它将不再是全屏视图。
var camImage:UnityEngine.UI.RawImage;
var baseRotation:Quaternion;
var webcamTexture:WebCamTexture;
var rotation:UnityEngine.UI.Text;
function Start () {
webcamTexture = new WebCamTexture(Screen.width,Screen.height);
camImage.texture=webcamTexture;
camImage.material.mainTexture = webcamTexture;
webcamTexture.Play();
rotation.text= webcamTexture.videoRotationAngle.ToString(); // to check the angle
}
【问题讨论】:
-
您可以在执行任何旋转之前获取相机的宽度和高度,并使用它来将纹理拉伸到所需的尺寸。我使用的是正交相机,所以我的代码可能不适用于您的实现。
标签: unity3d unity3d-gui