Unity C#旋转相机轴

时间:2016-04-03 22:04:16

标签: c# unity3d camera

有些人可能认为这个问题属于Unity Answers论坛,但我无法在那里得到任何帮助。

所以我有这段代码:

using UnityEngine;
using System.Collections;

public class CameraController : MonoBehaviour {

    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;
        transform.rotation = player.transform.rotation;
        transform.Rotate (new Vector3 (45, 00));
    }
}

它有效。但是每当相机转动时,播放器就会失焦。在这里我们用图像描绘这个(圈出的区域是玩家):

Circled area is the player.

修改

显示相机位置的屏幕截图:

Camera Position

0 个答案:

没有答案