- Home /
Which functions to which update, got confused
Well hi everyone, i have a real quick question for you. I know the script order, I know what FixedUpdate, Update and LateUpdate are. But i got confused about somethings, it's just complicated for me for now. Let me explain what my system is :
I got a character, it moves with rigidbody. All rigidbody movement lines are in FixedUpdate. And in Update, i check whether velocity is higher than a value or not, in order to detect if isMoving.
As a child object, I got a camera. Now, in the camera scripts, i have some quaternion.lerps lines. What i do is, if character's isMoving is false, i only let camera to be rotated ( free look while player stands still ) by Quaternion.Lerp, in both x and Y axis. If character's isMoving is true, i rotate the player body's y rotation, and rotate the camera's x rotation, by using Quaternion.Lerp and achieve a casual fps style camera controls.
So everything works fine but there can be some shutterings or glitches, and i assume that these can be caused because of the misconnection between updates. According to my situation, in which update should i put those camera script's camera and player lerping codes ? I tried all three but couldn't succeed, maybe I should change some of the lines only, like camera lerps to late update but player lerps to fixed or normal update. Something like that, got stuck, anyone ? Thanks :)
From experience, camera rotation should always be in LateUpdate.
Your answer
Follow this Question
Related Questions
lerp to 0, problem with horizontal value 1 Answer
Updating at frameRate some fixedUpdated gameObject 1 Answer
Unit rotation fails consistently on all slerp rotations after the first? 0 Answers
Mathf.Lerp working in one direction but not the other 1 Answer
Lerping euler angles make entire spin 3 Answers