Toggle camera sensitivity

So here’s what I’m adding to a JavaScript version of MouseLook:

	if (Input.GetButton("Zoom"))
	{
	sensitivityX = 1;
	sensitivityY = 1;
	}

How do I make this so that it toggles on and off?

if(Input.GetButton(“Zoom”)){
sensivityX = 1;
sensivityY = 1;
}else{
sensivityX = 10;
sensivityY = 10;
}

is this what you mean?

if you’re pressing the zoom button you’ve got a sensivity of 1, when you arent pressing it, its got a sensivity of 10 :slight_smile:

Edit:

im just gonna make this in C# as i cant remember the syntax for javascript, i’ll try to explain what i do though, also there might be an easier way to do it, but this is how i would do it :wink:

//make a boolean that will tell you if you're using low sensivity or not.
private bool lowSensivity = false;

//remember to change it to "input.GetButtonDown" or the sensivity will keep 
//changing for every frame as long as you are pressing the Zoom button.
if(Input.GetButtonDown("Zoom")){
     if(!lowSensivity){
          sensivityX = 1;
          sensivityY = 1;
          lowSensivity = true;
     }else{
          sensivityX = 10;
          sensivityY = 10;
          lowSensivity = false;
     }
}