- Home /
How often does the internal physics calculation get called?
For this example say my Fixed Update time step is 30hz (0.033s) and my frame rate for the update call is 60hz (0.0166s).
How often will the internal physics calculation happen that occurs after the Fixed Update call?
Is it attached to the Fixed Update call so that it only happens at 30hz or will it run at however fast the game loop is running to keep up with the frame rate update calls?
I am asking this because I apply a force in my fixed update and I am logging my position of my rigid body in my update call and i would expect there to be a few log statements where my position hasn't moved because the internal physics calculation hasn't taken place unless they are not actually tied together.
Answer by creganjordan292 · Aug 24, 2017 at 11:21 PM
By default, physics operations occur once every 0.02 seconds, or 50hz. Each FixedUpdate call is bound to the physics engine, and a change of the physics timescale will result in a change of the speed of the FixedUpdate.
Yes I understand this. I guess my question is the physics engine bound to fixed update? Because I do not understand how my rigid body can have two different positions in between fixed update calls if the physics calculation only gets called on that time interval. Thanks!
The physics engine is not bound to FixedUpdate(), but rather vice versa. If you go to Edit > Project Settings > Time you will see an option for "Fixed Timestep" which Unity's documentation describes as "A framerate-independent interval that dictates when physics calculations and FixedUpdate() events are performed." It does not explicitly state that FixedUpdate() is dependant on the physics engine, but is implied as the FixedUpdate() call is part of a physics engine update.
What you are most likely observing is interpolation that is performed by the rigidbody that approximates (interpolates) the position based on previous movement data. Disable that and see if that has any effect.
Yes it was interpolation I thought I had turned it off but it appears not. Thanks!