- Home /
Physics explosion when pausing during collision
I have a pause button that sets fixedDeltaTime and Time.timeScale to 0 and back. If I pause right when one object collides with another, when I unpause, they go flying at far more than the original force.
Anyone know why this is happening?
Not worth an anwswer, but try setting those variables to a very small value ins$$anonymous$$d of 0, like 0.00001
Thanks, I tried that. Didn't work, but I found that not changing the fixedDeltaTime at all while pausing with Time.timeScale did the trick. Why was I under the impression that fixedDeltaTime had to be 0 as well? Could have sworn I read that on the forums somewhere.
yeah you only need to change the timescale to effectively pause the game.
I just had the same problem, it is because the Unity documentation says to also lower the fixedDeltaTime.
http://docs.unity3d.com/Documentation/ScriptReference/Time-timeScale.html "If you lower timeScale it is recommended to also lower Time.fixedDeltaTime by the same amount."
I'm assu$$anonymous$$g they mean to only do this if your timeScale is NOT 0, but unfortunately they don't mention it! An easy mistake to make.
Answer by jaybinaryspace · May 27, 2013 at 04:34 AM
Hi, Also had this issue just now. The way I fixed it is... when pausing, first get your objects velocity, then set isKinematic=true. When you unpause, set isKinematic=false and set velocity to your previous value.
Hope that helps. Regards, Jay
Your answer
![](https://koobas.hobune.stream/wayback/20220613071603im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Exploding two gameobjects from the center of an collision 1 Answer
How can I make my physics objects stay frozen (eg in mid-air) until touched by another object? 1 Answer
How does Angle of collision affect velocity? 0 Answers
Using Raycasts to change the X and Y position of a moving GameObject? 1 Answer
Checking for Collisions Before GameObject Creation 3 Answers