Unity 3D Game Engine – Camera Facing Billboard

This is useful for billboards which should always face the camera and be the same way up as it is.

1. Hierarchy create the structure:

– Main Camera

– Empty Object (parent)
– Plane (child)

2. Rotate Plane to face the Main Camera

3. Select Empty Object and assign CameraFacingBillboard.JS:


#pragma strict

var m_Camera : Camera ; // Assign in Inspector

function Start () {

}

function Update () {
	transform.LookAt(transform.position + m_Camera.transform.rotation * Vector3.forward,
			                 m_Camera.transform.rotation * Vector3.up);

}

4. Hierarchy> DRAG AND DROP Main Camera over Inspector> CameraFacingBillboard.JS, Camera var

5. Run to see the final result

Original Article: http://wiki.unity3d.com/index.php?title=CameraFacingBillboard