Question by 
               nedvdd42 · Feb 21, 2018 at 01:41 AM · 
                movementprogrammingmovement scriptsmoothteleport  
              
 
              How to make an object move, not teleport?
I'm trying to make a door slam shut (vertically) after 'x' time. I've managed to get it to shut after the correct amount of time, but it teleports, when I want to slide shut? How do i fix this?
Code:
using UnityEngine; using System.Collections; public class DoorClose : MonoBehaviour { public Transform target; private float delay; private float timer;
 void Start()
 {
     delay = 1;
 }
 // Update is called once per frame
 void Update()
 {
     timer += Time.deltaTime;
     if (timer > delay)
     {
         transform.position = Vector3.Lerp(transform.position, target.position, Mathf.SmoothStep(3f, 3f, 3f));
     }
 }
}
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Please help to smooth player movement. 0 Answers
Smooth speed increase while sprinting 0 Answers
Mouse controlled 2D object bleeding through walls 1 Answer
MotionBlur 0 Answers
Face direction of a Vector 3 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                