I’m using a Text Mesh component, in a gameobject. I make this gameobject look at the camera but it is acting pretty strange, rotating, etc… Do anybody know what could be happening? How to do billboarding in unity? I have tried doing it manually but I get same result as with look at :S.
How are you making the TextMesh face the camera (parenting to camera, changing direction with a script…)? If you are using a script, perhaps you could post it for examination.
Sorry for the delay, I have been out past two weeks.
About the billboarding thing… Now I’m using a simple LookAt() on the go containing the Game Object to face the camera. The problem now is that it is corretly aligned but Text Mesh faces along Z- not Z+ and text shows reversed (it is rotated 180 degrees).
THe code I use for the billboard is pretty simple:
GameObject go=GameObject.Find("Main Camera") as GameObject;
textObject.transform.LookAt(go.transform);
I have tried to set a prefab with the text mesh facing Z+ but it allways keeps facing Z-. Is there anyway to fix this?.
I apologize for necroing an old post but it took me a couple of days of silently browsing the forums to find this simple code snippet that is an alternative to the GUIText option and that fixes the reverse text mesh you get when you use LookAt. I registered to these forums just to post this response
private var cam : GameObject;
function Start ()
{
cam = GameObject.Find("ProtoThirdPersonCam") as GameObject;
}
function Update () {
transform.rotation = cam.transform.rotation;
}