This is a pretty basic question, I’m sure. I’m thinking to myself I should probably know this based on how novice it is but anyways I have a ray cast coming from my player’s position that is following the camera. I am using this to tell if the camera is hitting something so it can then re-adjust to a position where it is no longer inside an object. It works fine but is very jittery and glitchy because there is no smoothing involved.
if(Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), hit)){
distance3 = hit.distance - 1.3;
}
Is there any way I can increase distance3 smoothly to the hit.distance?
Thanks in advance.