How to smooth a variable to a max hit point.
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.
Your answer

Follow this Question
Related Questions
adding range onto 2d raycast 3 Answers
Line of Sight and Raycasting 0 Answers
UI panel without Image component as Raycast target? It is possible? 5 Answers
Change color of sprite when hit by raycast [SOLVED] 2 Answers
Raycast doesnt work with any resolution 0 Answers