<<スクリプト>>
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Airplane : MonoBehaviour { private float miuTurnInputValue; private Rigidbody miuRb; private float miuNoseInputValue; private void Start() { miuRb = GetComponent<Rigidbody>(); } void Update() { // 前進は自動 transform.Translate(0f, 0f, 3f * Time.deltaTime); // 旋回 miuTurnInputValue = Input.GetAxis("Horizontal"); float turn = miuTurnInputValue * 100 * Time.deltaTime; Quaternion turnRotation = Quaternion.Euler(0, turn, 0); miuRb.MoveRotation(miuRb.rotation * turnRotation); // 機首(上昇、下降) miuNoseInputValue = Input.GetAxis("Vertical"); float noseTurn = miuNoseInputValue * 30 * Time.deltaTime; Quaternion turnNoseRotation = Quaternion.Euler(noseTurn, 0, 0); miuRb.MoveRotation(miuRb.rotation * turnNoseRotation); } }