how to stop updating FOV
I want my fov to increase as my player sprints, but whenever i press shift to sprint it keeps updating and makes my Fov continuously updates and keeps increasing to an ungodly level, who do i make it happen only once, each time i sprint.
whole update:
 void FixedUpdate()
 {
     baseFov = NormalCam.fieldOfView;
     float t_hmove = Input.GetAxisRaw("Horizontal");
     float t_vmove = Input.GetAxisRaw("Vertical");
     bool sprint = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
     bool IsSprinting = sprint && t_vmove > 0;
     Vector3 t_direction = new Vector3(t_vmove, 0, t_hmove);
     t_direction.Normalize();
     float t_adjustedSpeed = speed;
     if (IsSprinting) t_adjustedSpeed *= sprintModifier;
     rig.velocity = transform.TransformDirection (t_direction) * t_adjustedSpeed  * Time.deltaTime;
     if (IsSprinting) { NormalCam.fieldOfView = Mathf.Lerp(NormalCam.fieldOfView, baseFov * SprintFovModifier, Time.deltaTime * 8f); }
     else { NormalCam.fieldOfView = baseFov; }
 }
just fov stuff:
     if (IsSprinting) { NormalCam.fieldOfView = Mathf.Lerp(NormalCam.fieldOfView, baseFov * SprintFovModifier, Time.deltaTime * 8f); }
     else { NormalCam.fieldOfView = baseFov; }
Answer by biT1249 · Jul 18, 2020 at 12:23 AM
@heldtooth Hmm... well first question is did you assign a value to baseFov? what i mean is that you leftbaseFov as just this:
  baseFov = NormalCam.fieldOfView;
Without assigning a value to baseFov, then the fov will remain the same. May be the problem here... I am a beginner in Unity, so i am not very familiar with the code... sorry.. and the text colors aren't the colors I am familiar with, so sorry again. I hope that this will maybe help.. I hope I wrote what you needed to know. Sorry once again!
Oh, I just realized. okay, so this is what you need to do. instead of making baseFov = NormalCam.fieldOfView;
$$anonymous$$ake baseFov a float like this:
public float baseFov = //whatever number that you wanted;
else { NormalCam.fieldOfView = baseFov; }
then, the Field of View will be the number assigned to baseFov. :)
Your answer
 
 
             Follow this Question
Related Questions
Need help with spy glass to see through objects. 1 Answer
2D Sprite Vertices 0 Answers
Converting FOV to Focal Length? 1 Answer
Enemy AI: Player attacke when in FOV 0 Answers
Disable Animation when object is visible on camera 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                