unityでプレイヤーを作ってるのですがオブジェクトの向きに合わせて移動の仕方がわかりません
今のコードはこれです
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class player2 : MonoBehaviour {
public float speed;
// Use this for initialization
void Start () {
speed += 1;
}
// Update is called once per frame void Update () { if (Input.GetKey(KeyCode.A)){ transform.Rotate(new Vector3(0, 0, -speed)); } if(Input.GetKey(KeyCode.D)){ transform.Rotate(new Vector3(0, 0, speed)); } }
}
初心者なので細かく教えてくれるとありがたいです
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/11/21 07:11 編集