Unity DOTS Rollback Questions

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!

Check the thread here: Fixed timestep features coming to Entities / DOTS Physics packages

In short, we’ve separated physics and rendering step, physics now updates at the fixed rate and there is no need to keep them in sync. You can use smoothing on the body to interpolate/extrapolate the bodies if your rendering is not in sync with physics.

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”.

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.

2 Likes

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?

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.

1 Like

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?

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.