标签:unity3d frame player tco 方向 log form fse gid
获取垂直水平方向上的输入:
float moveHorizontal = Input.GetAxis("Horizontal"); float moveVertical = Input.GetAxis("Vertical");
给刚体一个力:
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical); GetComponent<Rigidbody>().AddForce(movement * speed * Time.deltaTime);
摄像头45度俯视角:
Camera:
Position: x(0) y(5) z(-6) Rotate: x(45) y(0) z(0) Scale: x(1) y(1) z(1)
摄像机跟随:
public GameObject player; private Vector3 offset; // Use this for initialization void Start () { //摄像机与跟随物体的初始相对位置 offset = transform.position - player.transform.position; } // Update is called once per frame void LateUpdate () { //跟随物体的位置加上相对位置 transform.position = player.transform.position + offset; }
标签:unity3d frame player tco 方向 log form fse gid
原文地址:http://www.cnblogs.com/lurenjiashuo/p/unity3d-tools.html