image - Switch device camera in Unity 3d -
i using webcamtexture class open photographic camera device. want switch photographic camera front end , vice versa in between game play. can help?
webcamdevice[] devices = webcamtexture.devices; webcamtexture webcamtexture = new webcamtexture(devices[1].name); renderer.material.maintexture = webcamtexture; webcamtexture.filtermode = filtermode.trilinear; webcamtexture.play();
this opens front end camera. can't switch camera.
i got solution. need set name of device. default photographic camera "camera 0" , "camera 1" front end camera. first stop photographic camera , alter set device.
if (devices.length > 1) { webcamtexture.stop(); if (frontcamera == true) { webcamtexture.devicename = devices[0].name; frontcamera = false; } else { webcamtexture.devicename = devices[1].name; frontcamera = true; } webcamtexture.play (); }
image unity3d camera crop unityscript
No comments:
Post a Comment