Quantcast
Channel: Questions in topic: "webcam"
Viewing all articles
Browse latest Browse all 256

Use one webcamtexture on multiple gameobject

$
0
0
I was trying [This Code][1] to map Theta S camera to the sphere. ![alt text][2] Like this, there is two half-sphere. The mapping is done by shaders, so I don't have to care about this. Both piece of sphere has same code: public int cameraNumber = 0; private WebCamTexture webcamTexture; void Start() { WebCamDevice[] devices = WebCamTexture.devices; if (devices.Length > cameraNumber) { webcamTexture = new WebCamTexture(devices[cameraNumber].name, 1280, 720); GetComponent().material.mainTexture = webcamTexture; webcamTexture.Play(); } else { Debug.Log("no camera"); } } What's the problem is, only "sphere1" renders WebCamTexture. I tested with additional test plane, and only the plane rendered WebCamTexture. (Both spheres didn't). It seems only one gameobject can render one WebCamTexture. How can I render one WebCamTexture on multiple gameobject? I already tried This and This, but both didn't work. In This Page, it suggested a solution in one-line: ![alt text][3] Which I couldn't understand. Can anyone help me? [1]: https://github.com/theta360developers/unity-streaming/tree/master/goroman [2]: /storage/temp/143725-thetasphere.png [3]: /storage/temp/143726-solution.png

Viewing all articles
Browse latest Browse all 256

Trending Articles



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