using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraMove : MonoBehaviour
{
public float zOffset = 4;
public float yOffset = 7;
public Transform target;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void LateUpdate()
{
//摄像机的位置,等于目标的位置,进行向量偏移
this.transform.position = target.position + -target.forward * zOffset + target.up * yOffset;
this.transform.LookAt(target);
}
}
摄像机移动脚本