I honestly have no idea how Mathf.Lerp works, when I use it, instead of ‘smoothing out’ the object’s position or number, it INSTANTLY jumps from one value to another based on the last digit; time. I have two examples in my code where the Mathf.Lerp instantly jumps from one digit to another instead of smoothing it out…Can someone please explain to me how it works and if it is suppose to do this?
//EXAMPLE 1
if(Input.GetButton("Fire2")&&!isZooming&&allowZoom){
isZooming=true;
currentZoomDistance=zoomDistance;
currentZoomDistance=Mathf.Lerp(60,currenZoomDistance,Time.deltaTime*zoomInSmooth); //MATHF LERP!
playerCameraComponent.fieldOfView=zoomDistance;
}
//EXAMPLE 2
else{
isProning=false;
Crouch();
playerCameraObject.transform.position.y=Mathf.Lerp(playerCameraObject.transform.position.y,playerCameraObject.transform.position.y+controllerCrouchHeight+controllerProneHeight,Time.deltaTime*smooth);//MATHF LERP!