BillBoard

using UnityEngine;
using System.Collections;

public class BillBoard : MonoBehaviour
{
    private Camera cameraLookAt=null;

    void Update()
    {
        cameraLookAt = Camera.main; 
        if (cameraLookAt==null)
        {
            //Debug.LogError("<Error>Main Camera not found!");
            return;
        }

        transform.LookAt(cameraLookAt.transform);
        Vector3 v3 = transform.rotation.eulerAngles;
        transform.rotation = Quaternion.Euler(new Vector3((v3.x + 90.0f), v3.y, v3.z));
    }
}
posted @ 2012-06-08 14:03  斯芬克斯  阅读(358)  评论(0编辑  收藏  举报