planeやQuadなどの板ポリにMacやiPhoneなどのカメラ情報を
貼付けるのにwebcamtextureを使うと簡単です。
サイズは、publicにして任意に変更できるようにしておきました。
こちらが、簡単なスクリプトになります。
WebCameScript
using UnityEngine;
using System.Collections;
public class WebCamScript : MonoBehaviour {
public int Width = 1920;
public int Height = 1080;
public int FPS = 30;
void Start () {
var euler = transform.localRotation.eulerAngles;
transform.localRotation = Quaternion.Euler( euler.x, euler.y, euler.z - 90 );
var devices = WebCamTexture.devices;
if (devices.Length > 0)
{
var webcamTexture = new WebCamTexture(Width, Height, FPS);
renderer.material.mainTexture = webcamTexture;
webcamTexture.Play();
}else
{
Debug.Log("Webカメラが検出できませんでした");
return;
}
}
}