Unity2014. 8. 4. 16:22

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));

transform.Rotate (0f, h * turnSpeed * Time.deltaTime, 0f);

}

}

'Unity' 카테고리의 다른 글

중력을 추가 Physics.gravity.y  (0) 2014.08.04
로컬좌표계에서 캐릭터 이동  (0) 2014.08.04
C# IInput.GetAxis ("Horizontal")와 transform.Translate()  (0) 2014.08.04
C# 회전  (0) 2014.08.04
C# 이동 Input.GetAxis ("Horizontal");  (0) 2014.08.04
Posted by 코드버무려