I know what fixed update is, and I know you should update physics in there but I still don’t understand why you should do it. I can’t find any thing on google so Im asking it here. (Ive seen some tutorials that do physics in update (like velocity, addforce etc). So my question is
Why do physics in FixedUpdate?
The thing about physics timing is that it actually DOES vary according to franerate, but it is still kept within minimum and maximum limits. Fixed Updte is called exactly before every physics update, so you do not have to worry about timing and inconsistencies. Update, on the other hand, is called based on framrate and not the speed of physics updates.
One word… Consistency
Fixed Update is separate from the Rendering Update (or Just Update) , this means Physics will run at a more consistent rate .
to Elaborate, Fixed update will update at more set "Physics " intervals, lets say every 20ms, Update on the other hand varies a lot, … all the time, we usually like it around 15ms but it jumps around to 40ms and down to 10ms.
so if your car is accelerating at 1m/s/s you will find that using fixed update , it at every second, the car will increase its speed by exactly 1m/s. In Update the amount it accelerate depends how many calls it received in that second (so if 60 calls your car will gain 1.2m/s, if 25 0.5m/s etc).
The Rigid Body article Explains this a little bit.
That isn’t true. It you think about it, it doesn’t even make any sense.
“Update physics” can mean a lot of different things, done a lot of different ways. Some are best in Update (anything that reads Input,) some need to be in FixedUpdate. As you noted in a comment, you can sometimes add *Time.deltaTime
to move something from FixedU to U.
As long as you know that “fixed” in FixedUpdate means it ignores framerate, which may vary, and tries to run at a constant speed, you can figure out where each particular “update physics” should be. In practice, it’s not something to worry about right away. Can jam everything into one or the other, and think/move as you see problems.