我试图在android肖像模式下显示全屏Webcamtexture。 但当我在我的设备上建立和测试它的旋转和videoRotationAngle是90如何在Android肖像模式下将WebcamTexture全屏显示?
我使用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
}
在执行任何旋转之前,您可以获取相机的宽度和高度,并使用它来将纹理拉伸到所需的尺寸。 我使用正交相机,所以我的代码可能不适用于您的实现。 – LoungeKatt