在Unity中实现视角固定跟随player:
using UnityEngine;
using System.Collections;
public class FollowPlayer : MonoBehaviour{
public GameObject player; //脚本中所有的public变量都会在面板中显示并可以赋值;
//将player的值赋给它
void Start(){
}
这样就可以在脚本中访问GameObject
void Update(){
//获取GameObject的位置参数
Vector3 play_position = player.transform.position;
//设置camera的位置参数
this.transform.position = new Vector3 (play_position.x +, play_position.y +, play_position.z + );
}