您的位置:首页 > 移动开发 > Unity3D

Unity摄像机跟随玩家移动脚本

2016-07-18 23:09 651 查看
放主摄像机上,直接上代码.

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);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: