Hey guys, fairly simple question:
I’ve got a menu system that consists of 2D planes in world space with a script that makes them always face the camera:
function Update () {
// Face the camera directly.
transform.LookAt(Camera.main.transform.position);
// Rotate so the visible side faces the camera.
transform.Rotate(90, 0, 0);
}
The planes are on a culling mask with a secondary camera so they render on top of everything else… fairly standard, looks like this at best (the icons/text are located around the turret, in world-space):
Trouble is, when you view an object from a tilt above or below the horizontal, the rotation of the objects does not match the rotation of the camera view, ending up in a derpy situation such as this:
I need a way to keep the icons/text horizontal relative to the screen. Any idea how I could pull this off?
Thank you!