Unity3D c# 使对象物体始终面向摄像机
作者:互联网
using System.Collections; using System.Collections.Generic; using UnityEngine; public class LookAtMainCamera : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { //当前对象始终面向摄像机。 this.transform.LookAt(Camera.main.transform.position); this.transform.rotation = Quaternion.Slerp(this.transform.rotation, Quaternion.LookRotation(Camera.main.transform.position - this.transform.position),0); } }
标签:Unity3D,c#,transform,System,摄像机,Camera,Collections,using,position 来源: https://www.cnblogs.com/guangzhiruijie/p/15825006.html