- Home /
JRPG style Movement using Vector3.Lerp jittering in place?
Im making a script for movement that is based off of the old nintendo style jrpgs. The script is supposed to move my player to the destination position in a Vector3.Lerp. When i try to move my character moves only a few feet and jitters back and forth at really small distances. What am i doing wrong?
 private void InputMovement(){
         transform.position = Vector3.Lerp(startPosition, endPosition, 1 * Time.deltaTime);
         
         if (Input.GetKey (KeyCode.W)){
             endPosition = startPosition + new Vector3(0,0,1);
         }
         if (Input.GetKey(KeyCode.S)){
             endPosition = startPosition + new Vector3(0,0,-1);
         }
         if (Input.GetKey(KeyCode.D)){
             endPosition = startPosition + new Vector3(1,0,0);
         }
         if (Input.GetKey(KeyCode.A)){
             endPosition = startPosition + new Vector3(-1,0,0);
         }
     }
Answer by Punkjim420 · Oct 10, 2014 at 10:44 PM
i think i found the problem. I looked a little closer and my position was being set to the new vector3s rather than adding the vector3s to my current "startPosition" position. so in short, for some reason i was setting, not adding.
Your answer
 
 
             Follow this Question
Related Questions
Making a bubble level (not a game but work tool) 1 Answer
MouseWheel Lerp Smoothing Problem 1 Answer
Smooth movement like Lerp with Touch Input? 2 Answers
Doing something wrong with lerp? 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                