Unity3D学习-相机跟踪
作者:互联网
public class FollowPlayer : MonoBehaviour
{
Transform m_player;
float speed = 20;
Vector3 m_offset;
// Start is called before the first frame update
private void Awake()
{
m_player = GameObject.FindWithTag(Tag.player).transform;
m_offset = transform.position- m_player.position;
}
private void Update()
{
transform.position = Vector3.Lerp(transform.position, m_offset + transform.position, speed * Time.deltaTime);
}
}
标签:Unity3D,Vector3,transform,private,相机,player,跟踪,offset,position 来源: https://blog.csdn.net/nwnuhexc/article/details/122805195