using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class _camFlower : MonoBehaviour
{
public Transform target; // 需要跟随的物体
public float smoothSpeed = 0.125f; // 相机跟随速度
public Vector3 offset; // 相机和物体的偏移量
void LateUpdate()
{
Vector3 desiredPosition = target.position + offset; // 相机应该在的位置
Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed); // 相机移动到目标位置
transform.position = smoothedPosition; // 更新相机位置
transform.eulerAngles = new Vector3(20, 0, 0);
transform.LookAt(target.position);
}
}
12-15
2642
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-27
06-12
02-09
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-08
1081
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-28
7258
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)