using System.Collections; using System.Collections.Generic; using UnityEngine; /** * 小怪看向SceneCamera * @Author: chenxin * @Date: 2020-11-12 17:46:56 */ namespace KTGMGemClient { public class LookAtSceneCamera : MonoBehaviour { private Camera sceneCamera; // Start is called before the first frame update private void Start() { sceneCamera = GameObject.Find("SceneCamera3D").GetComponent(); Invoke("LookAtCamera",0.2f); } public Vector3 offect = new Vector3(0, 0.07f, 0.04f); private void LookAtCamera() { transform.LookAt(transform.position + sceneCamera.transform.rotation * Vector3.forward, sceneCamera.transform.rotation * Vector3.up); transform.localPosition = offect; } // Update is called once per frame private void Update() { } //Orient the camera after all movement is completed this frame to avoid jittering void LateUpdate() { // transform.LookAt(sceneCamera.transform); } } }