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);
    }
}

  

上一篇:TurtleBot3-自动驾驶Noetic-模拟仿真项目 2.相机校准


下一篇:树莓派ARM64系统中如何设置opencv-python读取高清摄像头画面