unity3d 公告板(billboard)

using UnityEngine;
using System.Collections;

public class Billborad : MonoBehaviour {

    public Camera m_Camera;
    public Vector3 Normal;//面法線
    Quaternion direction;

    // Use this for initialization
    void Start()
    {
        direction = Quaternion.FromToRotation(new Vector3(0, 0, 1), Normal);
        print(GetInstanceID());
    }

    // Update is called once per frame
    void Update()
    {
        transform.rotation = m_Camera.transform.rotation * direction;

        //GameObject GO = GameObject.Find("3rd Person Controller");
        //transform.position = GO.transform.position + new Vector3(0,1,0);
    }
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章