u3d中的Billboard

View Code
 1 using UnityEngine;
 2 using System.Collections;
 3 
 4 public class BillBoard : MonoBehaviour {
 5 
 6            private Camera cam;
 7            void Start () {
 8                       cam = Camera.mainCamera;
 9             }
10            void Update () {
11                        Vector3 v = cam.transform.position - transform.position;
12                        v.x = v.z = 0.0f;
13                        transform.LookAt(cam.transform.position - v);
14             }
15 }
posted @ 2012-07-25 14:26  渡蓝  阅读(166)  评论(0编辑  收藏  举报