its changing but i want it to change slowly
function Update () {
if (Input.GetKey (“w”))
{
Camera.main.fieldOfView += 100*Time.deltaTime;
}
}
its changing but i want it to change slowly
function Update () {
if (Input.GetKey (“w”))
{
Camera.main.fieldOfView += 100*Time.deltaTime;
}
}
Well, the speed factor is right there in your script:
function Update () {
if (Input.GetKey ("w")) {
// See this '100'? --------\/
Camera.main.fieldOfView += 100 * Time.deltaTime;
// That number determines how fast the FoV will change. Decrease it.
}
}
Decrase it using a public variable:
var FoVChangeRate : float = 100;
Camera.main.fieldOfView += FoVChangeRate * Time.deltaTime;
Camera.main.fieldOfView = Mathf.Lerp(Camera.main.fieldOfView, 100, 1*Time.deltaTime);
this worked perfictly