private Transform player;
public float speed = 2;
public float up = 3.04f, away = 4.55f;
void Start()
{
player = GameObject.FindWithTag("Player").transform;
}
// Update is called once per frame
void Update()
{
if (player!=null)
{
Vector3 targetpos = player.position + Vector3.up * up - player.forward * away;
transform.position = Vector3.Lerp(transform.position,targetpos,speed * Time.deltaTime);
transform.LookAt(player);
}
}
Unity摄像机跟随
最新推荐文章于 2023-12-10 15:49:23 发布