###前提・実現したいこと
既に左側のスティックによるキャラクターの前後ろ横移動は完成しています。
現在は右スティックでメインカメラを上下左右に回転させる段階で悩んでいます。
ソースコードにはしっかりとメインカメラを回転させられるように記述しているのですが、コントローラーのスティックを操作しても反応がありません。
右スティックでメインカメラを自由に回転できるようにしたいです。
###発生している問題・エラーメッセージ
エラーメッセージ
###該当のソースコード
C#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMove : MonoBehaviour {
public float speed = 15.0f; public float jumpspeed = 8.0f; public float gravity = 20.0f; private Vector3 moveDirection = Vector3.zero; // Use this for initialization void Start () { } // Update is called once per frame void Update () { CharacterController controller = GetComponent<CharacterController> (); if(controller.isGrounded) { moveDirection = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical")); moveDirection = transform.TransformDirection (moveDirection); moveDirection *= speed; if (Input.GetButton ("Jump")) moveDirection.y = jumpspeed; } moveDirection.y -= gravity * Time.deltaTime; controller.Move (moveDirection * Time.deltaTime); gameObject.transform.Rotate(0, Input.GetAxis("Horizontal2"), Input.GetAxis("Vertical2"));
}
}
###試したこと
インプットマネージャーの設定を変更して試行錯誤してみましたが、なかなか上手くいきませんでした。
###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/10/10 13:07 編集