- Home /
Character,Camera,Updates,Frame Rates,Jitter&Stutter, I need some explanations.
Well hello everybody. I've been pushing my mind into this issue I have for some time. I actually need information about some topics. I've been searching for a little while, but I am not actually really good at understanding some CPU & Frame related topics, and I wasn't able to get the whole idea in some of the answers & explanations I found, therefore I need a little help. First of all, I am trying to write my FPS character system (not a shooter game though, I need to have some different type of movement), where the character will be a rigidbody.I have some empty child gameObjects, some hold animations, some hold position for camera, and a camera object as a child of them. I have a lot of lerping and slerping. Character hiearchy is Character > UpperBodyPlaceHolder > CameraPositioner > CameraAnimator > CameraHolder > Camera.
In my character script, I lerp the rotation of the UpperBodyPlaceHolder object, I also lerp the CameraHolder's rotations. I need to have a specific type of "sways & looking" for the character, that's why I have been using Quaternion.Slerp & Lerp a lot. Also, I wrote my own camera script, in which camera's rotation is controlled by slerping with some variables that are depending on Input. I also slerp the rotation of my player ( rigidbody.rotation ) to achieve some kind of a movement I'd like to. (Not a casual FPS, camera and character is not rotating at the same time when we want to look around) Well anyways, as I have mentioned, I have a lot of lerps & slerps.
Everything works fine, except the fact that I have jittery movement. Not a huge jitter though, but obviously visible, especially on mouse movements and when looking down. My scene has a constant amount of frames per second, which is 60~64.
So I've been looking into this, I have seen lots of different solutions and ideas to prevent stutterring & jittering issues, but I wasn't able to use any of those ideas on my project, since I actually have not understand the "logic" behind those ideas.
I concluded that, using fixed update, update, late update is really important on this jitter issue. Also, when using Lerp and Slerp, some people just don't go :
Time.deltaTime * 5f;
They use a variable instead of just typing 5f, and that variable is something that is being calculated dependingly on the frame rate I believe. I have no idea how to achieve something like that. So as a result, I need someone to enlighten me with a little simplier language, about these topics : Frame rate logic in unity, what actually is a "time step", what is the logic behind all those calculations made for lerping & slerping. ( As I said, people make some calculations instead of just giving speed value ), the connections between : fixedDeltaTime,deltaTime,FixedUpdate,LateUpdate. And, how can i achieve the smoothest movement in a project like mine, physics driven player, a camera, and usage of lerp & slerp funtions, any idea about that would be great.
Sorry for the long question, but I really need some explanations about these, in the way that a person who did not deal with frame rate stuff before could understand.