I want my camera only to move then I hit my arrow keys. can anyone help? This script only dose it with a mouse
`using UnityEngine; using System.Collections;
public class camera : MonoBehaviour { public Transform target; public float walkDistance; public float runDistance; public float height; public float zoom; public float xSpeed = 250.0f; public float ySpeed = 120.0f;
private Transform _myTransform;
private float x;
private float y;
private float BaseValue; //me
// Use this for initialization
void Start () {
if(target == null)
Debug.LogWarning("we have no tageet");
_myTransform = transform;
}
void LateUpdate() {
if(Input.GetMouseButton(0)) {
x += Input.GetAxis("Mouse X") * xSpeed * 0.02f;
y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02f;
// y = ClampAngle(y, yMinLimit, yMaxLimit);
Quaternion rotation = Quaternion.Euler(y, x, 0);
Vector3 position = rotation * new Vector3(0.0f, 0.0f, -walkDistance) + target.position;
_myTransform.rotation = rotation;
_myTransform.position = position;
}
}
}`