赞
踩
1. 创建一个目标(以圆球为例),再创建一个摄像头放在该目标的上方
2.创建一个脚本,脚本代码如下:
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
-
- public class CamMove : MonoBehaviour
- {
- public GameObject Player;
- public Vector3 offset;
- // Start is called before the first frame update
- void Start()
- {
- offset = transform.position - Player.transform.position;
- }
-
- // Update is called once per frame
- void Update()
- {
- transform.position = Player.transform.position + offset;
- }
- }
3.再把该脚本添加到摄像机上
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。