# Extra Rotation on Camera

Right I am trying to do this since few days and I haven’t succed yet:
basically I have a camera which rotates around an object when using the keys left,right,up and down(also zooms).
I am using this script:

``````var target : Transform;
var edgeBorder = 0.1;
var horizontalSpeed = 360.0;
var verticalSpeed = 120.0;
var minVertical = 20.0;
var maxVertical = 85.0;
var minDistance = 1; //Min distance of the camera from the target
var maxDistance = 20;

private var x = 0.0;
private var y = 0.0;
private var distance = 0.0;

function Start(){
x = transform.eulerAngles.y;
y = transform.eulerAngles.x;
distance = (transform.position - target.position).magnitude;
}

function LateUpdate(){

//Zooming with mouse
distance += Input.GetAxis("Mouse ScrollWheel")*distance;
distance = Mathf.Clamp(distance, minDistance, maxDistance);

var dt = Time.deltaTime;
x -= Input.GetAxis("Horizontal") * horizontalSpeed * dt;
y += Input.GetAxis("Vertical") * verticalSpeed * dt;

y = ClampAngle(y, minVertical, maxVertical);

var rotation = Quaternion.Euler(y, x, 0);
var position = rotation * Vector3(0.0, 0.0, -distance) + target.position;

transform.rotation = rotation;
transform.position = position;

}

static function ClampAngle (angle : float, min : float, max : float) {
if (angle < -360)
angle += 360;
if (angle > 360)
angle -= 360;
return Mathf.Clamp (angle, min, max);
}

function buttonRightRotation(){
transform.Rotate(Vector3.up * 45);
print("Doooone");

}
``````

I have added the function buttonRightRotation() which I call from another script attached to a gui botton:

``````var rotateCameraZoom : RotateCameraZoom;
var target : Transform;
function OnMouseDown () {
rotateCameraZoom.buttonRightRotation();
}
``````

This is in order to have a extra interface control on rotation(eventually I will have for bottons:left, right, up and down)

At the moment this does not produce anything, it gives me no errors.
Does anyone knows the solution for this?

OK I found out that it only works if I switch off the first script:face_with_spiral_eyes:
In brief how do I modify the scripts so that I perform the same action of the arrow keyboard keys also when I press the gui button?