Search Unity

Decrease camera sensitivity?

Discussion in 'Scripting' started by Treasureman, Oct 23, 2014.

  1. Treasureman

    Treasureman

    Joined:
    Jul 5, 2014
    Posts:
    563
    I need a scrip so that what in the input "Aim" is held then the camera sensivity will go from 0.6 to 0.2. How do I do this

    P.S. I prefer javascript. I just started scripting so I don't know much, but I've been learning Java. It would be easier in case the script didn't work
     
  2. Pantomorphic

    Pantomorphic

    Joined:
    May 8, 2013
    Posts:
    53
    Code (JavaScript):
    1. function Update ()
    2. {
    3. if(Input.GetButton("Fire2"))
    4. lookSensitivity == 0.2
    5. if(Input.GetButton("Fire2") == false)
    6. lookSensitivity == 0.6
    7. }
    Hope this helps. This code is assuming your look sensitivity variable is named "lookSensitivity" and that your aim button is right mouse click.
     
  3. Treasureman

    Treasureman

    Joined:
    Jul 5, 2014
    Posts:
    563
    So, it wont recognize lookSensitivity, but I have no idea how to figure out what the variable should be? How do I figure this out?
     
  4. Pantomorphic

    Pantomorphic

    Joined:
    May 8, 2013
    Posts:
    53
    Put this code in the same script as your mouse look script. Look for the Look Sensitivity variable. If you are using the Character Controller from Unity it should be "lookSensitivity."