I’m building an app which I eventually plan to deploy to both Android and iOS. Currently I need to set the screen to show what the camera sees at the screens native size. I’m able to resize the plane, and display the camera to the plane. However the camera image is getting stretched and distorted in a really weird way. Is there a way I can resize the plane to the screen size and not have the camera image get distorted? Here is the code I’m currently using, I’ve attached this script to my plane object.
public class CameraLoader : MonoBehaviour {
// Use this for initialization
void Start () {
WebCamTexture camera = new WebCamTexture();
Renderer renderer = GetComponent<Renderer>();
// set the size of the plane
var height = Camera.main.orthographicSize * 2;
var width = height * (Screen.width / Screen.height);
transform.localScale = new Vector3(width, height, 1);
renderer.material.mainTexture = camera;
camera.Play();
}
// Update is called once per frame
void Update () {
}
}
Or if there is an easier way to just display what the camera sees full screen, that would be awesome.