放主摄像机上,直接上代码.
using UnityEngine;
using System.Collections;
public class FlowPlayerMove : MonoBehaviour {
public Vector3 juli=new Vector3(0f,2.5f,-2f);
private GameObject player;
public float smoothing=6;
// Use this for initialization
void Start () {
player=GameObject.FindGameObjectWithTag ("Player");
}
// Update is called once per frame
void Update () {
Vector3 pos = player.transform.position + juli;
transform.position= Vector3.Lerp (transform.position,pos,smoothing*Time.deltaTime);
}
}
本文介绍了一种使用Unity实现摄像机平滑跟随玩家的方法。通过编写C#脚本,设置摄像机相对于玩家的位置,并利用Lerp函数实现平滑过渡效果。

3419

被折叠的 条评论
为什么被折叠?



