Quantcast
Channel: Questions in topic: "device"
Viewing all articles
Browse latest Browse all 270

Weird Behaviour WebCamTexture to GUITexture

$
0
0
Hi, I am working with WebCamTexture. Here is my script place it on a GUITexture, it should work, you can skip the debug GUIText: ---------- using UnityEngine; using System.Collections; using System.IO; public class PhotoShoot : MonoBehaviour { public string deviceName; public GUIText debugHeight; public GUIText debugWidth; WebCamTexture wct; // Use this for initialization void Start () { WebCamDevice[] devices = WebCamTexture.devices; deviceName = devices[0].name; wct = new WebCamTexture(deviceName, 360, 360, 20); wct.requestedHeight = 360; wct.requestedWidth = 360; guiTexture.texture = wct; wct.Play(); guiTexture.pixelInset = new Rect(wct.width, wct.height, -wct.width*2, -wct.height*2); } // Update is called once per frame void Update () { debugHeight.text = wct.height.ToString(); debugWidth.text = wct.width.ToString(); //transform.rotation = baseRotation * Quaternion.AngleAxis(wct.videoRotationAngle, Vector3.up); } So.. I gain access to the device camera and it renders the image on the device, It's rotated to the right. But's that not the real problem. The problem is that as I rotate the device, the image stretches and contracts. A perfectly shaped circle turns into an oval. Where is the problem? The GUITexture? The resolution? How can I achieve a "Camera" to take photos that works properly using WebCamTexture? I am using Unity 4.3.6f, an iPhone 5 as my device, in portrait orientation.

Viewing all articles
Browse latest Browse all 270

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>