Android : webcamTetxure angle rotation in unity3d

on Sunday, March 8, 2015


i am having a difficulty rotating the webcamtexture in my android device


here is my scene :


enter image description here


and here is the image in my phone : enter image description here


you can see the difference in rotation and scaling between the phone and the editor .. how can i fix this problem so my phone display the correct rotation of the webcamtexture ?



using UnityEngine;


using UnityEngine.UI; using System.Collections;


public class Camera_pnl : MonoBehaviour {



//// Use this for initialization
WebCamTexture webCameraTexture;
void Start() {
GUITexture BackgroundTexture = gameObject.AddComponent<GUITexture>();
BackgroundTexture.pixelInset = new Rect(0,0,Screen.width,Screen.height);

WebCamDevice[] devices = WebCamTexture.devices;
foreach(WebCamDevice cam in devices)
{
if(cam.isFrontFacing )
{
webCameraTexture = new WebCamTexture(cam.name);
webCameraTexture.deviceName = cam.name;
webCameraTexture.Play();
BackgroundTexture.texture = webCameraTexture;
}
}
}

void Update () {
if (Input.GetKey (KeyCode.Escape)) {
Invoke("LoadGame",0.1f);
}
}

void LoadGame()
{
webCameraTexture.Stop ();
webCameraTexture = null;
Application.LoadLevelAsync("Game");
}

}


here is the code of the Quad ... thank you in advance


0 comments:

Post a Comment