Unity
C# IInput.GetAxis ("Horizontal")와 transform.Translate()
코드버무려
2014. 8. 4. 16:18
using UnityEngine;
using System.Collections;
public class Move2 : MonoBehaviour {
public float moveSpeed = 5f;
public float turnSpeed = 180f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
float h = Input.GetAxis ("Horizontal");
float v = Input.GetAxis ("Vertical");
transform.Translate (new Vector3 (0f, 0f, v * moveSpeed * Time.deltaTime));
}
}