I have this code:
var moveSpeed = 5.0;
function Update () {
// Calculate speed
var speed = moveSpeed;
if (Input.GetKey(KeyCode.LeftShift)) {
speed *= 2;
}
// Move the GameObject
transform.Translate(Vector3.forward * Input.GetAxis("Vertical") * Time.deltaTime * speed);
transform.Translate(Vector3.right * Input.GetAxis("Horizontal") * Time.deltaTime * speed);
}
How would i make it so that the object moves relative to which ever camera is active (I have a few that i switch between in the scene)?