Search Unity

Unity DOTS Rollback Questions

Discussion in 'Physics for ECS' started by spirachi77, Nov 25, 2020.

  1. spirachi77

    spirachi77

    Joined:
    Sep 26, 2017
    Posts:
    17
    Hi!
    I'm trying to make a fighting game using unity DOTS and Physics, I have done some digging and I got a few questions,

    I need to decouple rendering and physics updates, how would I do this?
    Could I use the hybrid renderer for this, if so, then how?
    If not, then how could I decouple rendering and physics steps?
    Does anyone have any code examples of controlling when the physics steps?
    Where would I copy the physics world data from and where should I store it?

    Thank you!
     
  2. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
  3. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,508
    Is that a provided feature, or must be implemented by us? As for the linked post, the op states that "interpolation feature is beyond the scope of the Entities-related changes here".
     
  4. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    I can speak for physics, and it's a per body thing, you can choose it on UI (PhysicsBodyAuthoring script, Smoothing). It defaults to None. For adding it at runtime, you add PhysicsGraphicalSmoothing component data, and PhysicsGraphicalInterpolationBuffer in case you want specifically Interpolation.
     
    Edy and Lukas_Kastern like this.
  5. spirachi77

    spirachi77

    Joined:
    Sep 26, 2017
    Posts:
    17
    Thank you so much!
    Just a few more questions, how would I re-tick the physics update? So far, I've been ticking the entire update by calling an update from a fixedupdate monobehavior, what's the alternative?
    Should I use the hybrid renderer when doing this, or should I just use the default renderer?
     
  6. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    Physics now ticks in a fixed update by default, just let the systems run normally and that's it. They are part of the FixedStepSimulationSystemGroup, you'll need that info if you need to write your own systems to interfere with the physics ones (Build, Step, Export, EndFrame). So, no need to ever manually call the OnUpdate() method of any system.

    I think you can use any renderer, the samples use hybrid renderer, but to be honest I don't know what are the implications of using one or another. Maybe someone else jumps in to answer this, especially if someone tried one way or the other.
     
    friflo likes this.
  7. spirachi77

    spirachi77

    Joined:
    Sep 26, 2017
    Posts:
    17
    gotcha, how would I call the FixedStepSimulationSystemGroup from the code? Also, are there rollback samples I could look at? If so, where can I find them?
     
  8. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    Not sure what you mean by "call the FixedStepSimulationSystemGroup", it should be executed by default in a DOTS based application. Unfortunately, there are no rollback samples yet, at least not in the physics samples. You could check in a broader DOTS forum.