用右操纵杆旋转相机

时间:2019-05-16 21:10:51

标签: c# unity3d

我制作了3D游戏,我希望通过操纵杆旋转相机。我的游戏有一个第一人称控制器,该控制器的动作已经由左操纵杆控制,我希望我的主摄像机随右操纵杆一起旋转。

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{
    CharacterController cc;
    public Joystick joystick;



    // Start is called before the first frame update
    void Start()
    {
        cc = GetComponent<CharacterController>();

    }

    // Update is called once per frame
    void Update()
    {
        float xInput = joystick.Horizontal;
        float zInput = joystick.Vertical;
        cc.Move(new Vector3(xInput, 0, zInput));

    }
}

0 个答案:

没有答案