Created
June 10, 2014 11:12
-
-
Save daemonfire300/42f380a0c5f25fb76253 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
//WASD to orbit, left Ctrl/Alt to zoom | |
using UnityEngine; | |
public class KeyboardIsometric : MonoBehaviour | |
{ | |
public float speed = 29.0F; | |
public float rotationSpeed = 100.0F; | |
public GameObject target; | |
public GameObject gLight; | |
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; | |
new_position.z = -45.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