コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Cursor.lockState = CursorLockMode.Locked;
        }

        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical   = Input.GetAxis("Vertical");


        bool jump = Input.GetButton("Jump");

        playerController.SetJumpPressed(jump);

        Vector3 direction = camera.transform.forward * moveVertical;

        direction += camera.transform.right * moveHorizontal;
        playerController.SetDesiredDirection(direction);

        Vector3    euler  = camera.transform.rotation.eulerAngles;
        Quaternion locked = Quaternion.Euler(0, euler.y, 0);

        playerController.SetDesiredRotation(locked);
    }