Skip to content

Instantly share code, notes, and snippets.

@bibinba
Last active October 27, 2017 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bibinba/f324d04bca8404e460c1c6756e16eab2 to your computer and use it in GitHub Desktop.
Save bibinba/f324d04bca8404e460c1c6756e16eab2 to your computer and use it in GitHub Desktop.
webcamから取得した映像を任意のマテリアルのテクスチャにするコード。ThetaSにも使える
using UnityEngine;
using System.Collections;
public class webcam : MonoBehaviour {
public int Width = 1920;
public int Height = 1080;
public int FPS = 30;
public Material material;
WebCamTexture webcamTexture;
void Start () {
WebCamDevice[] devices = WebCamTexture.devices;
webcamTexture = new WebCamTexture(devices[0].name, Width, Height, FPS );
material.mainTexture = webcamTexture;
webcamTexture.Play();
}
void Update () {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment