- Home /
How to keep world space canvas in front of camera but only rotate on y axis (kind of like parenting)
So I made a world space UI that I would like to stay in front of the camera at all times. I want it to be a little below the cameras Quaternian.identity rotation so that you have to rotate down a bit to see it. This means I cant parent the canvas because it would rotate with the camera when the camera looks down. I also want it to rotate with the camera so at any time (regardless of the cameras forward) the camera can look down and see the canvas. I CAN NOT PARENT, the way my game is setup parenting wouldnt work. I switch bodies and controllers and need the canvas to place in front of the current camera when I do
Answer by VR_Junkie · Oct 21, 2021 at 11:45 PM
Got it this worked
// Update is called once per frame void Update() { Vector3 fakeForward = Camera.main.transform.forward; fakeForward.y = 0.0f; fakeForward.Normalize(); transform.position = Vector3.Lerp(transform.position, new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y - 1.0f, Camera.main.transform.position.z) + fakeForward 2.0f, Time.deltaTime 20.0f); transform.LookAt(Camera.main.transform); }
Your answer
![](https://koobas.hobune.stream/wayback/20220613044455im_/https://answers.unity.com/themes/thub/images/avi.jpg)