Question by
overthrowrobotics · Nov 25, 2015 at 02:11 PM ·
cameratexture2drotate object
Rotate Texture2D to face camera
I'm using a Kinect 2 camera and it has a Texture2D that is an RGB feed from the camera. I want to rotate that texture to always face the camera.
Here's the code that creates the Texture2D. I tried kinect_rgb.transform but I get a message that there is no definition for that.
Texture2D kinect_rgb;
// Use this for initialization
void Start () {
KinectManager manager = KinectManager.Instance;
if (manager && manager.IsInitialized ()) {
kinect_rgb = manager.GetUsersClrTex ();
GetComponent<Renderer>().material.mainTexture = kinect_rgb;
}
}
Comment
Answer by ExamplesAreExamples · Nov 25, 2015 at 02:45 PM
Texture2D isn't a Component or GameObject.
It has no transform.
Sounds like you want to use a RawImage component and set the texture of that to kinect_rgb
, or use some other kind of renderer. Then rotate the transform of the RawImage etc.