- Home /
Why does changing fixedDeltaTime create strong forces on rigidbodies?
We are building a game where we are trying to achieve a slow motion effect with rigidbodies in motion. We are changing Time.timeScale from our default of 2 to a slo-mo value of 0.01. We also change Time.fixedDeltaTime accordingly from a default of 0.02 down to 0.001. This achieves a nice fluid slo-mo effect that is very satisfying.
The problem, however, is that rigidbodies throughout our game using FixedJoints receive large amounts of force as the fixedDeltaTime value changes rapidly. By quickly toggling between a fixedDeltaTime of 0.02 to 0.001, we see objects brushing against others (with only miniscule amounts of motion) receiving large forces that cause them to explode away from each other and fly off screen.
If we change only timeScale and leave fixedDeltaTime set to 0.02, we don't see the large forces affecting our rigidbodies but the rigidbodies and some other items we update ourselves in FixedUpdate routine move jerkily compared with a fixed update of 0.001 when tileScale is 0.01.
We've tried lerp'ing between the fixedDeltaTime changes but it doesn't fix the issue.
Thank you for any help!
Andy Riedel CTO & Founder PlayGearz, Inc
possible this caused by you applying forces in FixedUpdate as constant, but on decreasing fixedTimeStep from 0.02 to 0.001 will cause FixedUpdate calls 20 times more often (1000 times a sec). so your forces should be decreased proportionally.
We aren't applying any of our own forces at all in FixedUpdate. The default physics engine seems to be creating them.
try to set low value of fixedtimestep before game run - does it works correctly?
That didn't seem to work either. Setting it lower makes the physics much more unstable even when not in "normal" mode (timeScale = 0.02).
then it's something with physics program$$anonymous$$g. cause default physics should not changed when fixedTimeStep decreased. just more CPU load.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Spaceship physics - adding resistance 2 Answers
Scripting "physics"? 1 Answer
2.5D Platformer - Jump Question 1 Answer
Vector3.Reflect problems 4 Answers