Hi I am currently trying to use a webcam texture on an object rendered in my scene, but when I use the texture I can't display the feed from my webcam. I would like to have the object rendered on a marker with texture taken from the latest frame of the webcam. Is there a way to do this? Thanks
Hey I figured it out. In the ARCamera GameObject it has a Camera Child which has a BackgroundPlane Child object. This Child contains a texture which is the video background. Here is some code that takes that texture then applies it to a robot model which I render in my scene.
// Update is called once per frame
void Update () {
Renderer rend2 = GetComponent<Renderer>();
Texture im = rend2.material.mainTexture;
if(im == null)
{
Debug.Log("NOT WORKING");
}
if(im != null)
{
Debug.Log("FINALLY WORKS");
}
GameObject C1 = GameObject.Find("Robot2");
Renderer rend = C1.GetComponent<Renderer>();
rend.material.mainTexture = im;
}
Hope this helps!