Canvas In Front Of Camera

Hi everyone!!
I have a little problem and I hope that someone could find a solution for that.
I’m developing a vr application and I wanna show a canvas including a pause button every time the user looks in the same direction for 5 seconds.

With this simple line of code I show the panel at the right distance from the camera :

  • transform.position = cam.transform.position + cam.transform.forward * distance;

But someone could explain me how to also rotate the canvas to perfectly face the camera?

I have tryed with this, but doesn’t work:

  • transform.rotation = Quaternion.Euler(cam.transform.rotation.x, cam.transform.rotation.y, cam.transform.rotation.z);

Lol was so easy:

  • transform.rotation = cam.transform.rotation;
5 Likes