using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraMove : MonoBehaviour {
//平滑强度
public float MoveSmooth = 1f;
//相机的高度
public float CameraHight = 5f;
//距目标的多长
public float DistanceToTaget = 10f;
//目标
private Transform Target;
void Start () {
Target = GameObject.FindWithTag("Player").GetComponent<Transform>();
}
void Update ()
{
Vector3 NewPos = Target.position + Vector3.up * CameraHight - Target.forward * DistanceToTaget;
transform.position = Vector3.Lerp(transform.position, NewPos, MoveSmooth*Time.deltaTime);
transform.LookAt(Target);
}
}
003==超简单的第三人称相机
最新推荐文章于 2024-05-20 18:43:27 发布