- Home /
how to change the filedof view slowly
its changing but i want it to change slowly
function Update () {
if (Input.GetKey ("w")) { Camera.main.fieldOfView += 100*Time.deltaTime; } }
Answer by zeuo · May 16, 2012 at 02:17 AM
Camera.main.fieldOfView = Mathf.Lerp(Camera.main.fieldOfView, 100, 1*Time.deltaTime); this worked perfictly
Next time, please make it clearer what you actually want it to do.
Also, how do you make it move back to what the original was set to?
Answer by syclamoth · May 16, 2012 at 02:14 AM
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;
Your answer
Follow this Question
Related Questions
Time.deltaTime is not smooth 1 Answer
referring to a particular material 0 Answers
Health Regeneration Issues. 2 Answers
How to fast forward time (or just skip it) properly? 2 Answers
Game over scene when the time is up ? 2 Answers