I noticed that sometimes when the character in our game moved they would suddenly turn 90 degrees left or right and turn back immediately which created a jittery movement bug. After a while, I noticed that it only happened when I went perfectly straight. After that, I noticed that the jittery movement did not happen when going straight but also the camera had to be in its default position. This took a while to test but eventually, I was able to figure out what the problem was.
The problem was that when the character was moving their transform would be rotated according to their movement direction and the camera's position. When moving straight the character's direction was 0 and the camera's position rotation was 90 degrees so it would rotate the character by those 90 degrees. I put in a check to see if the player is moving straight and if the camera is in its default position. With that fix in place, the jittery movement bug was gone.
Taylor Addington
Top comments (0)