Unity研究中です。毎月スクリプトを書いていきます。
今月のコード
using UnityEngine;
using System.Collections;
public class Rotatechick : MonoBehaviour {
public float speed = 4.0f;
void Update () {
if (Input.GetKey ("up")) {
transform.position += transform.forward * speed * Time.deltaTime;
}
if (Input.GetKey ("down")) {
transform.position -= transform.forward * speed * Time.deltaTime;
}
if (Input.GetKey("right")) {
transform.position += transform.right * speed * Time.deltaTime;
}
if (Input.GetKey ("left")) {
transform.position -= transform.right * speed * Time.deltaTime;
}
}
}
The following two tabs change content below.