Search Unity

Is there any way to force a fixed update?

Discussion in 'Physics' started by testure, Dec 2, 2014.

  1. testure

    testure

    Joined:
    Jul 3, 2011
    Posts:
    81
    Without getting into too much detail, I'm working on a client/server multilayer game and im rolling my own reliable UDP network code. Right now I'm hung up on getting client side prediction for physics working the way I've seen it done in other engines because there doesn't seem to be a way to force FixedUpdate to happen on the current frame.

    Example scenario:

    1. Client bumps into a box locally, box reacts with physics.

    2. Server is authoritative, so it says "no, you had latency- somebody knocked the box out of your path and you missed . Here is the new transform, velocity, etc"

    3. Client gets new values for the box and forces a fixed update so the physics simulation plays correctly on the client machine.

    So in my situation, I can't force a fixed update so the simulation continues with bad data until the next fixed update, which causes worse jittery/jumpy behavior since the clisn't is that much further behind the server by the time a fixed update happens.

    Anybody have any suggestions on where to go from here?
     
  2. SpeakUpGames

    SpeakUpGames

    Joined:
    Nov 25, 2014
    Posts:
    56
  3. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,618
    Have you tried deferring changes and then applying network changes at the start of fixedupdate?