Last active
October 27, 2017 11:03
-
-
Save bibinba/f324d04bca8404e460c1c6756e16eab2 to your computer and use it in GitHub Desktop.
webcamから取得した映像を任意のマテリアルのテクスチャにするコード。ThetaSにも使える
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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