Input keyboard control

July 31, 2013   ·   0 Comments

void Update () {
		if(Input.GetKey(KeyCode.UpArrow)){
				gameObject.transform.Translate(new Vector3(0,0,1f)*Time.deltaTime );
			}
		if(Input.GetKey(KeyCode.DownArrow )){
				gameObject.transform.Translate(new Vector3(0,0,-1f)*Time.deltaTime );
		}
		if(Input.GetKey(KeyCode.LeftArrow )){
			   gameObject.transform.Translate(new Vector3(1,0,1f)*Time.deltaTime );
		}
		if(Input.GetKey(KeyCode.RightArrow )){
			   gameObject.transform.Translate(new Vector3(-1,0,1f)*Time.deltaTime );
		}
	}

shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Unity3D4

Amazon

adsbygoogle

Recent Posts

Categories

Amazon