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-03-06 14:58:22 发布