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<Camera>();
|
}
|
|
// 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);
|
transform.LookAt(transform.position + sceneCamera.transform.rotation * Vector3.forward,
|
sceneCamera.transform.rotation * Vector3.up);
|
}
|
}
|
}
|