Created
September 30, 2017 07:23
-
-
Save nrfm/35e69346eb08ccb20cc1355b845199a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class TransformFunctions : MonoBehaviour | |
{ | |
public float moveSpeed = 10f; | |
public float turnSpeed = 50f; | |
void Update () | |
{ | |
if(Input.GetKey(KeyCode.UpArrow)) | |
transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime); | |
if(Input.GetKey(KeyCode.DownArrow)) | |
transform.Translate(-Vector3.forward * moveSpeed * Time.deltaTime); | |
if(Input.GetKey(KeyCode.LeftArrow)) | |
transform.Rotate(Vector3.up, -turnSpeed * Time.deltaTime); | |
if(Input.GetKey(KeyCode.RightArrow)) | |
transform.Rotate(Vector3.up, turnSpeed * Time.deltaTime); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment