Pause bug/glitches on Tutorial

syamilsynz 4 years ago updated by Lazlo Bonin (Lead Developer) 4 years ago 5

I'm just started learn chronos and currently follow the tutorial provided,

but it seem the pause not working properly on enemy. They still move when I set timescale = 0 (pause). and when I set the timescale = 1 (normal), the enemy will jump back and start move at pause position.

Chronos Version:
Unity Version:
Satisfaction mark by syamilsynz 4 years ago

I experienced this as well. They keep moving but it's a linear drift from where they should be stopped (because their rigidbodys become kinematic?)

Working on Fix

I found the issue and will have it fixed for v.2.4.8 -- I think.

The Unity 2D rigidbody system is very complex. Chronos needs to be able to have full control over the rigidbodies for pause and rewind, and therefore sets them to "kinematic" when the time scale is zero or lower. In 3D, this works perfectly fine; collisions are recorded but all movement stops.

In 2D, it gets a little more complicated. Setting the rigidbody to kinematic will record collisions and stop gravity and force movements, but (for some reason) still enable velocity movement, unlike the 3D counterpart. This is what happens in v.2.4.7, which is causing the bug you see -- the falling enemies keep their velocity, even though they're kinematic. Setting the rigidbody to non-simulated stops all movement, but disables collision, which was a bug up until v.2.4.6.

In v.2.4.8, I'll be setting the 2D rigidbodies to static instead. This should disable all movements and retain collisions. Hopefully that will be the right setting, at last!

I just realized that in the 2D Platformer sample project, for whatever reason (more arcade-y?), the Y Gravity is set to -30 (instead of default -9.81). This seems to amplify the drift effect..


Updating this: the static body type won't work either, because it does not register trigger collisions, make all area clocks moot. What I'll be doing in v.2.4.8 is setting the body type to kinematic and forcing zero velocity in the timeline's fixed update. Hopefully this won't have any side effect.