Created
April 20, 2013 15:00
-
-
Save daemonfire300/5426267 to your computer and use it in GitHub Desktop.
This file contains hidden or 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; | |
public class KeyboardIsometric : MonoBehaviour | |
{ | |
public float speed = 29.0F; | |
public float rotationSpeed = 100.0F; | |
public GameObject target; | |
public bool isController = false; | |
void Update() { | |
Vector3 new_position = new Vector3(0,0, -30.0f); | |
if(isController){ | |
float translation_y = Input.GetAxis("Vertical") * speed; | |
float translation_x = Input.GetAxis("Horizontal") * speed; | |
translation_x *= Time.deltaTime; | |
translation_y *= Time.deltaTime; | |
target.transform.Translate(translation_x, translation_y, 0); | |
} | |
//float rotation = Input.GetAxis("Horizontal") * rotationSpeed; | |
//rotation *= Time.deltaTime; | |
//target.transform.Rotate(0, rotation, 0); | |
new_position.x = target.transform.position.x + 5.0f; | |
new_position.y = target.transform.position.y + 5.0f; | |
transform.position = new_position; | |
//transform.LookAt(target.transform); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment