0
\$\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
\$\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\$
1
  • \$\begingroup\$ I thought it fixed everything, but sadly only the "exploding" rigidbodies. The cloths still behave madly when time is restarted. :\ \$\endgroup\$ – Tudvari Nov 14 '18 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.