我試圖在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