Posted September 15, 2023 by Sad Ogre Studios
Reported by: Eldar Bertsel
September 15, 2023
THE PROBLEM
For this week while I was working on the player controller I ran into the issue with a player camera rotation being very slow and non responsive. No matter how high you sensitivity is the camera would move like if you would be taping an arrow key once a second. Tap, camera moves a little, then stops. Tap, camera moves a little, then stops. This affects both vertical and horizontal rotation.
THE SOLUTION
The solution to the problem was relatively easy although to find it I had to spend a lot of time debugging the code. The problem was with using FixedUpdate instead of a LateUpdate. FixedUpdate is executed at a specific rate defined in the editor; while LateUpdate is executed after all the Update functions have been called. Seems like because of that specific rate the camera would move with what looks like a delay because it is skipping frames. When in LateUpdate the camera rotation would change every frame but after all the other updates are done, so there would be no frames that it would skip.