1
\$\begingroup\$

I'm trying to achive a Super Hot like gameplay, where the time only flows when the player moves.

But when I stop time, then restart it, physics simulation will be messed up. Like:

  • Cloths starts flying around like they are in a tornado.
  • Rigidbodies fly away, like they were shot from a cannon.

All of these without any kind of forces being applied to them. They were just standing still, I stopped time, then I restarted Time and Booom, rigidbodies fly around.

I use this in the player's Tick method:

auto settings = GetWorld()->GetWorldSettings();
settings->SetTimeDilation(timeScale);
\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

The reason why this is happening is because the Physics engine also runs on Tick... so when you manipulate the Time Dilation on Tick as well, you're going to run into these problems.

So you've got two possible solutions:

  1. Change the order that your Player's Tick method runs in (which you can do by making a child BP and then changing it in the Class Defaults section)... though you might still run into problems since Time Dilation affects the World tick rate, too... so maybe it's just best to try changing your player's Tick rate to Post-Physics.
  2. Instead of making the Time Dilate on Tick, you can set a Timer event Delegate to call every 0.1s or something like that and then just pass in your ne

Here's a link explaining some details about manipulating TickGroup in C++: https://answers.unrealengine.com/questions/231386/tickgroup-how-to-understand-that.html

example

\$\endgroup\$
2
  • \$\begingroup\$ I thought it fixed everything, but sadly only the "exploding" rigidbodies. The cloths still behave madly when time is restarted. :\ \$\endgroup\$
    – Tudvari
    Commented Nov 14, 2018 at 7:40
  • \$\begingroup\$ A few years later, I'm adjusting dilation on key press. I presume that means tick. I tried each of the physics changes - didn't help. Option 2 doesn't help any either. I also tried using a delay of 0.00001 to restart, same issues. \$\endgroup\$ Commented Apr 6, 2023 at 6:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .