using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {
 
 public float Speed = 10.0f;
 // Use this for initialization
 void Start () {
  
 }
 
 // Update is called once per frame
 void Update () {
  float h = Input.GetAxis("Horizontal");    //input ->  입력  좌우로 움직이는 명령어Time.deltaTime.
  float v = Input.GetAxis("Vertical");
  
  transform.Translate(Vector3.right * h * Speed *Time.deltaTime);     

 //왼쪽으로 움직이면 음수값이 나오기 때문에 left는 따로 적을필요 없다.
  transform.Translate(Vector3.up * v * Speed *Time.deltaTime);
  
 }

 

'유니티3D > 예제' 카테고리의 다른 글

PlayerCrtl  (0) 2013.07.25
PlayerCtrl_소스  (0) 2013.07.24
자동차게임 전체 스크립트  (0) 2013.07.23
도로밖으로 차 못나가게 하기  (0) 2013.07.22
도로 움직이는 예제  (0) 2013.07.22

+ Recent posts