Search Unity

Question Fixed update and movement frequency

Discussion in 'Physics' started by LTheodor, Dec 10, 2023.

  1. LTheodor

    LTheodor

    Joined:
    Feb 16, 2017
    Posts:
    2
    Ive been looking at posts regarding fixed update and i still dont really understand how exactly physics-"powered" movements work. If physics calculations happen by default at a 50hz frequency, what frequency do objects move at when it comes to actually rendering them? Or do all physics based translations happen at 50Hz regardless of actual framerate? If the frametime is much smaller than the fixedstep couldnt you interpolate the movements happening between fixed updates to make physics based movements smoother depending on framerate?
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,899
    FixedUpdate just plays catch up with the rest of the overarching Unity player loop. Basically, it checks if enough time has passed between frames, and if so, FixedUpdate runs before Update. If the frame rate is low, multiple FixedUpdate calls can happen before Update. If the frame rate is high, then multiple frames will pass before the next FixedUpdate.

    It's still pretty much happening in lock-step with everything else Unity is doing on a frame-by-frame basis. And if you want smooth rigidbody movement, just turn on Interpolate in the rigidbody settings.
     
    LTheodor likes this.
  3. LTheodor

    LTheodor

    Joined:
    Feb 16, 2017
    Posts:
    2
    Yeah RigidBody interpolation and extrapolation finally made things clear for me. Thanks