纳金网

标题: Unity3d billboard 公告板技术 [打印本页]

作者: yeu1233    时间: 2012-9-12 11:26
标题: Unity3d billboard 公告板技术
using UnityEngine;
using System.Collections;

public class LookAtCameraYRotationOnly : MonoBehaviour
{
    public Camera cameraToLookAt;

    void Update()
    {
        Vector3 v = cameraToLookAt.transform.position - transform.position;
        v.x = v.z = 0.0f;
        transform.LookAt(cameraToLookAt.transform.position - v);
    }
}






欢迎光临 纳金网 (http://rs.narkii.com/club/) Powered by Discuz! X2.5